home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Sound / Tracker / PTSUP2.LHA / PT Support archive / Sources / ProPrunerRep.S next >
Encoding:
Text File  |  1995-11-01  |  67.8 KB  |  2,797 lines

  1.  
  2. ; ProPruner example code, look below for more information.
  3. ; Maximum stack usage : ca. 108 bytes.
  4.  
  5. Go        move.l    4.w,a6
  6.         jsr    -132(a6)        ; _LVOForbid
  7.  
  8.         moveq.l    #0,d0
  9.         lea.l    GfxName(pc),a1
  10.         move.l    4.w,a6
  11.         jsr    -552(a6)        ; _LVOOpenLibrary
  12.  
  13.         tst.l    d0
  14.         beq.w    Exit
  15.  
  16.         lea.l    GfxBase(pc),a0
  17.         move.l    d0,(a0)
  18.  
  19.         bsr.w    GetVBR
  20.  
  21.         lea.l    PPR_MainData(pc),a0
  22.         move.l    d0,PPRM_VBR(a0)
  23.  
  24.         lea.l    Module,a0
  25.         bsr.w    PPR_Init        ; Initialize replay
  26.  
  27. MainLoop    move.l    GfxBase(pc),a6
  28.         jsr    -270(a6)        ; _LVOWaitTOF
  29.  
  30. .BeamLoop    move.l    GfxBase(pc),a6
  31.         jsr    -384(a6)        ; _LVOVBeamPos
  32.  
  33.         move.w    #$000,$dff180
  34.  
  35.         and.l    #$c0,d0
  36.         beq.s    .BeamLoop
  37.  
  38.         move.w    #$fff,$dff180
  39.         bsr.w    PPR_Music        ; Play some
  40.         move.w    #$000,$dff180        ; $78a
  41.  
  42.         btst    #6,$bfe001        ; ...And loop
  43.         bne.s    MainLoop
  44.  
  45.         bsr.w    PPR_End            ; Disable all notes.
  46.  
  47.         move.l    4.w,a6
  48.         jsr    -138(a6)        ; _LVOPermit
  49.  
  50.         move.l    GfxBase(pc),a1
  51.         move.l    4.w,a6
  52.         jsr    -414(a6)        ; _LVOCloseLibrary
  53.  
  54. Exit        moveq.l    #0,d0
  55.         rts
  56.  
  57. ;------------------------------------------------------------------------------
  58. ;Function:    VBR=GetVBR()
  59. ;Purpose:    Obtain vectorbaseregister independent of processor hardware.
  60. ;------------------------------------------------------------------------------
  61.  
  62. GetVBR        moveq.l    #0,d0
  63.         move.l    4.w,a6
  64.         btst.b    #0,297(a6)
  65.         beq.w    .Not68010
  66.         lea.l    VBR_Exec(pc),a5
  67.         jsr    -30(a6)            ; _LVOSupervisor
  68.  
  69. .Not68010    rts
  70.  
  71. ;Code to execute if processor >= 68010.
  72. ;Since not all assemblers handle the movec vbr,(ea) instruction, the opcode is
  73. ;included.
  74.  
  75. VBR_Exec    ;dc.l    $4e7a0801        ; = MOVEC VBR,D0
  76.         movec    vbr,d0
  77.         rte
  78.  
  79. GfxBase        dc.l    0
  80. GfxName        dc.b    "graphics.library",0
  81.     even
  82.  
  83. ;------------------------------------------------------------------------------
  84. ;==            NOTEPLAYER INTERFACE                     ==
  85. ;------------------------------------------------------------------------------
  86. PPRN_InitReg    macro    ; (Channel)
  87.         lea.l    $dff0a0,a5
  88.         endm
  89.  
  90. PPRN_KillSound    macro
  91.         endm
  92.  
  93. PPRN_KillCh    macro
  94.         endm
  95.  
  96. PPRN_TrigWave    macro    ; (Wavestart, Wavelen)
  97.         endm
  98.  
  99. PPRN_SetWave    macro    ; (Wavestart, Wavelen)
  100.         endm
  101.  
  102. PPRN_SetVolume    macro    ; (Volume)
  103.         endm
  104.  
  105. PPRN_SetRate    macro    ; (Rate)
  106.         endm
  107.  
  108. PPRN_SetMVolL    macro    ; (MVolume)
  109.         endm
  110.  
  111. PPRN_SetMVolR    macro    ; (MVolume)
  112.         endm
  113.  
  114. PPRN_Filter    macro    ; (State)
  115.         endm
  116.  
  117. ; Do actual mixing and trig replay.
  118. PPRN_MakeSound
  119.         rts    ; This is _NOT_ a macro!
  120.  
  121.  
  122.  
  123. ;------------------------------------------------------------------------------
  124. ;
  125. ;    $VER: ProPruner v1.2 Playroutine - by Håvard "Howard" Pedersen
  126. ;    © 1993-95 Mental Diseases
  127. ;    STRICTLY FOR PRIVATE USE!!!
  128. ;
  129. ;    Based on the ProPacker v2.1 playroutine by Estrup/Static Bytes and his
  130. ;    own improvement-ideas for ProPacker v3.0.
  131. ;
  132. ;    I cannot be held responsible for any damage caused directly or in-
  133. ;    directly by this code. Still, every released version is thouroughly
  134. ;    tested with Mungwall and Enforcer, official Commodore debugging tools.
  135. ;    These programs traps writes to unallocated ram and reads/writes to/from
  136. ;    non-ram memory areas, which should cover most bugs.
  137. ;
  138. ;    HISTORY:
  139. ;
  140. ;v0.4    Called ProCracker. Basically very similar to ProPacker v2.1.
  141. ;    * Added mastervolume possibilities through SetMasterVol().
  142. ;    * Added synchronization-byte sent trough effectcommand 8.
  143. ;    * Added restart-flag.
  144. ;
  145. ;v1.0    Renamed to ProPruner. First really useful version. This replay was
  146. ;    used in the "Hypnophone" musicdisk by Compact.
  147. ;    * Separate samplefile.
  148. ;    * Friendly DMA-wait using VHPOSR.
  149. ;    * Wrote ProPrunerStrip and ProPrunerSampler to simplify usage of
  150. ;      separate samplefiles.
  151. ;    * Added PreDouble boolean to speed up replay.
  152. ;    * Speeded up replay in numerous ways.
  153. ;    * Possibility to turn off mastervolume with MasterVol boolean.
  154. ;    * Possibility to disable audio channels.
  155. ;    * Added delta processing.
  156. ;    * Added support for speed 0 to halt module.
  157. ;    * Speeded up mastervolume routines by using macros instead of sub-
  158. ;      routines.
  159. ;    * Readded FineTune boolean. By some reason, it got deleted during the
  160. ;      development of v0.4. (My finetune boolean will save space as well as
  161. ;      rastertime!)
  162. ;    * Gave user possibility to fetch the VBR and pass to ProPruner.
  163. ;    * Added CIA possibilities. (You must add the interrupt yourself!)
  164. ;
  165. ;v1.1    Optimizations starts getting noticeable. Average speed on a normal A500
  166. ;    should be about 4-5 lines! Source-size is also increasing.
  167. ;    * DMAWait waited 224 ns instead of 280. It worked fine on my A1200, but
  168. ;      could fuck up on a 80 mHz 68060 with FPU and 60 ns fastram. (Or
  169. ;      something...)
  170. ;    * Small optimization on WaitDMA.
  171. ;    * To save further time when waiting for the DMA, WaitDMA is changed
  172. ;      from a subroutine to a macro. Now my WaitDMA macro provides minimum
  173. ;      overhead.
  174. ;    * PPR_Music() now trashes all registers except A7. This may optimize a
  175. ;      bit if your interrupt-code saves all registers anyway. (Mine does!)
  176. ;    * Numerous optimizations.
  177. ;    * Added boolean for 68020+ optimizations.
  178. ;    * Fixed the way PPR_Init() and PPR_End() disabled/enabled playing to
  179. ;      prevent audible bugs from occur when PPR_Music() was called while
  180. ;      initializing variables.
  181. ;    * Added DMADelay constant for user-selectable delay when using DMAWait.
  182. ;    * Optimized the MasterVolume code particulary.
  183. ;    * Several locations in the source used the clear-command on hardware
  184. ;      registers. This behaviour is discouraged by Commodore and is now
  185. ;      fixed.
  186. ;    * Added (selectable) PPR_Pause() and PPR_Continue().
  187. ;    * Added (selectable) PPR_Forward() and PPR_Rewind().
  188. ;    * Enforcer checked and found reliable. =D
  189. ;    * Removed a rather nasty bug of mine, which caused some modules to be
  190. ;      played without the fourth channel. (Not sure when it appeared, but I
  191. ;      admit it's mine...) :(
  192. ;    * Optimized finetune a lot.
  193. ;    * Made PPR_Level6 default to FALSE, since it's shitty implemented
  194. ;      concidering the lovely multitasking environment of the Amiga.
  195. ;
  196. ;v1.2    Things are getting somewhere. The need for a separate packer starts to
  197. ;    rise. Sourcesize is 62 Kb, more than three times the size of the
  198. ;    original ProPacker v2.1 replay!
  199. ;    * PPR_Init didn't reset the tempo when in CIA mode. Fixed.
  200. ;    * Halting the module with F00 didn't trig restartflag. Fixed.
  201. ;    * Set volume didn't work at all when PPR_MasterVol was set to true. 8(
  202. ;    * Finally added the PowerPattern structure I've been dreaming about.
  203. ;      Finetune, toneportamento and arpeggio were drastically optimized due
  204. ;      to this.
  205. ;    * Cleaned up the source a lot by making definitions of the voicedata-
  206. ;      and maindata- variables and ensured the entire source used it.
  207. ;    * Optimized the voicedata- and maindata-variables to make longword
  208. ;      accesses on longword boundaries.
  209. ;    * Toneportamento with finetune enabled would play crazy notes! Fixed.
  210. ;    * Indirext addressing is now used when accessing all variables,
  211. ;      resulting in even better speed.
  212. ;    * The play-routine is now (finally!) completely PC-relative.
  213. ;    * A long-standing bug could have caused the sample-addresses to become
  214. ;      totally fucked up. Fixed. (Another one bites the dust! 8)
  215. ;    * Numerous small optimizations. As always, I fucked up during
  216. ;      optimizing and had to compare the source line by line to an older
  217. ;      version to find the bug I inserted. ;(
  218. ;    * Playroutine now uses less space than earlier, since variables used by
  219. ;      pause, mastervolume etc. is now included based on the switches.
  220. ;    * The demo-source of ProPruner now fetches the VBR correctly.
  221. ;    * Playroutine source now contains version information. :)
  222. ;    * Optimized recognition of effectcommands.
  223. ;    * The demo-source now uses graphics-library for VBL-waiting.
  224. ;    * ProPruner is now fixed to work on almost any assembler! (Some if's
  225. ;      weren't standard in earlier versions...)
  226. ;    * Extended effectcommands are no longer called each frame no matter.
  227. ;      This optimises a lot when these are in use. Pattern delay engine had
  228. ;      to be altered due to this.
  229. ;    * Arpeggio no longer uses divx/mulx, but a counter. (Mo' speed!)
  230. ;    * Added NotePlayer interface to replay. This feature hasn't been tested
  231. ;      at all. Please report any bugs.
  232. ;    * Disabling of channels turned out to be buggy. You wouldn't actually
  233. ;      hear any sound on the disabled channels, but the replay would still
  234. ;      (in some places) adjust volume and turn on and off DMA for disabled
  235. ;      channels. Some people may not see why this was a serious bug, but the
  236. ;      reason for implementing disabled channels at all was to make them
  237. ;      free for sound-effects. (Games!)
  238. ;    * PPR_DMADelay removed. The DMAWait waited longer than it had to. The
  239. ;      CPU obvously wasn't fast enough to keep up with the changes in
  240. ;      VHPOSR. Uses I/O chips for timing.
  241. ;    * Added balance possibilities through left and right mastervolume. No
  242. ;      extra overhead provided.
  243. ;
  244. ;    TODO: (Things to do, bugs to squash...)
  245. ;
  246. ;* Make it possible to disable all handling of sample-pointers by PPR_Init(),
  247. ;  to allow the user to set up samples himself. (For song-like structures!)
  248. ;* Attempt to optimize invert loop.
  249. ;* Make PPR_Init() return errorcodes upon failure.
  250. ;* Optimize filter effectcommand.
  251. ;* Optimize PPR_Init() and PPR_SetMasterVol()
  252. ;* Ensure correct delay in level6-interrupt.
  253. ;* Steal ideas from other replays. (The Player, ProRunner, Promizer...)
  254. ;* Write own packer (with own format).
  255. ;* Get VBR in a nice manner.
  256. ;* Make PPR_Level6 nicer to the OS.
  257. ;* Channels on/off during play. (Too much work...!) (Selectable)
  258. ;* Optimize mastervolume so that only one macro is necessary.
  259. ;* Glissando still uses a loop. 8(
  260. ;* Audio hardware pointers located in the voiceinfo-variables.
  261. ;* Use counter instead of division when doing retrig note. (The last divx/mulx
  262. ;  in the code!)
  263. ;* Convert pattern break parameters to hex.
  264. ;* Use more local labels.
  265. ;* Usecode system like The Player. (With finetune and predouble integrated!)
  266. ;* Optimize WaitDMA to only wait when needed.
  267. ;
  268. ;------------------------------------------------------------------------------
  269. ;
  270. ;    CONSTANTS:
  271. ;
  272. ;Constant:    PPR_Level6(BOOL)
  273. ;Purpose:    If set to TRUE, a level 6 interrupt will be used for timing
  274. ;        delays instead of DMAWait. This gives optimum results, but
  275. ;        should only be enabled if you have EXCLUSIVE access to system
  276. ;        resources! Defaults to FALSE. This require this interrupt to be
  277. ;        free for usage, i.e. it might interfere with CIA.
  278. ;
  279. ;Constant:    PPR_SampleFile(BOOL)
  280. ;Purpose:    If set to TRUE, the samples are given separate to the replayer
  281. ;        upon PPR_Init(). This enables sample sharing and the
  282. ;        possibility to have the songdata located in fast. Defaults to
  283. ;        FALSE.
  284. ;
  285. ;Constant:    PPR_PreDouble(BOOL)
  286. ;Purpose:    If set to TRUE, the module will be processed, resulting in a
  287. ;        faster performance. This might _NOT_ work on all modules,
  288. ;        especially on long ones. Defaults to TRUE. ProPruner will
  289. ;        handle already processed modules.
  290. ;
  291. ;Constant:    PPR_MasterVol(BOOL)
  292. ;Purpose:    If set to TRUE, mastervolume features will be enabled. This
  293. ;        will consume more rastertime than without, therefore it
  294. ;        defaults to FALSE.
  295. ;
  296. ;Constant:    PPR_Delta(BOOL)
  297. ;Purpose:    If set to TRUE, the playroutine will handle delta packed
  298. ;        samples. This needs PPR_SampleFile to be enabled. Defaults to
  299. ;        TRUE if PPR_SampleFile is enabled.
  300. ;
  301. ;Constant:    PPR_Finetune(BOOL)
  302. ;Purpose:    If set to TRUE, the playroutine will handle finetune. Defaults
  303. ;        to TRUE, since most people nowadays uses finetune.
  304. ;
  305. ;Constant:    PPR_CIA(BOOL)
  306. ;Purpose:    If set to TRUE, PPR_SetBPM will be called whenever the CIA
  307. ;        tempo needs to be changed. Defaults to FALSE, since using the
  308. ;        CIA timers in a system-friendly manner is hard. Please remember
  309. ;        that level 6 interrupts will not work with a playroutine called
  310. ;        from within an interrupt. PPR_SetBPM is called with BPM (byte)
  311. ;        in D0, and may only trash D0 and D1.
  312. ;
  313. ;Constant:    PPR_68020(BOOL)
  314. ;Purpose:    If set to true, ProPruner will assemble with special 68020+
  315. ;        optimizations. Defualts to FALSE to avoid unexpected crashes.
  316. ;
  317. ;Constant:    PPR_PauseFuncs(BOOL)
  318. ;Purpose:    If set to true, PPR_Pause() and PPR_Continue() will be
  319. ;        included. defaults to false.
  320. ;
  321. ;Constant:    PPR_WindFuncs(BOOL)
  322. ;Purpose:    If set to true, PPR_Forward() and PPR_Rewind() will be
  323. ;        included. defaults to false.
  324. ;
  325. ;Constant:    PPR_PowerPatt(BOOL)
  326. ;Purpose:    If enabled, will cause PPR_Init() to convert the patterndata to
  327. ;        a more suitable format before playing.
  328. ;
  329. ;Constant:    PPR_NotePlayer(BOOL)
  330. ;Purpose:    If enabled, external functions will be used instead of banging
  331. ;        on the Amiga hardware registers when sound is wanted.
  332. ;
  333. ;Constant:    PPR_Channels(0-4)
  334. ;Purpose:    Selects number of channels to play. Nice for games. 8) Defaults
  335. ;        to 4. Disabling channels saves a huge amount of raster time.
  336. ;        NB! Do note that ProPruner will not sense ANY effectcommands on
  337. ;        the disabled channels! (Speed or pattern break...)
  338. ;
  339. ;    FUNCTIONS:
  340. ;
  341. ;Function:    PPR_Continue()
  342. ;Purpose:    Continues the module after a stop caused by PPR_Pause().
  343. ;
  344. ;Function:    PPR_End()
  345. ;Purpose:    Stops any sound currently being played on any audio channel and
  346. ;        brings module to a halt. (In reverse order, that is. :)
  347. ;
  348. ;Function:    PPR_Forward()
  349. ;Purpose:    Skips one position forward. Will restart if at end of module.
  350. ;        !!! This call will miss position jumps !!!
  351. ;
  352. ;Function:    PPR_Init(Module,SampleFile)(A0,A1)
  353. ;Purpose:    Initalize everything. You must call this first. Samplefile is
  354. ;        only necessary if PPR_SampleFile is TRUE. Module-data must be
  355. ;        a ProPacker 2.1 module. Do not call while module is playing,
  356. ;        stop current module with PPR_End() first. This function may
  357. ;        also be used to restart the module.
  358. ;
  359. ;Function:    PPR_Music()
  360. ;Purpose:    Play the module. Call this with an even interval. (50 times per
  361. ;        second gives optimum result.) Do note that this function
  362. ;        trashes all registers.
  363. ;
  364. ;Function:    PPR_Pause()
  365. ;Purpose:    Pauses the module. (Silence)
  366. ;
  367. ;Function:    PPR_Rewind()
  368. ;Purpose:    Skips one position backwards. If at position 0, the module will
  369. ;        wrap to the end. !!! This call will miss position jumps !!!
  370. ;
  371. ;Function:    PPR_SetMasterVol(LeftVolume,RightVolume)(D0.w,D1.w)
  372. ;Purpose:    Adjust the mastervolume of the module. Range is 0-63. Only
  373. ;        callable if PPR_MasterVol is set to TRUE. A value of 64 is also
  374. ;        interpreted as full volume.
  375. ;
  376. ;    DATAFIELDS:
  377. ;
  378. ;Field:        PPRM_Msg(PPR_MainData).b
  379. ;Contents:    Communication byte, sent from module via effect-command 8.
  380. ;
  381. ;Field:        PPRM_SongPos(PPR_MainData).b
  382. ;Contents:    The position of the module currently being played.
  383. ;
  384. ;Field:        PPRM_HiPattern(PPR_MainData).b
  385. ;Contents:    The highest pattern used in the module.
  386. ;
  387. ;Field:        PPRM_RestFlag(PPR_MainData).b
  388. ;Contents    If TRUE, module has restarted.
  389. ;
  390. ;Field:        PPRF_Positions(Module).b
  391. ;Contents:    Total number of positions in module.
  392. ;
  393. ;Field:        PPR_VoiceData+CH*PPRV_sizeof.l
  394. ;Contents:    A copy of the pattern step being played for the moment. For the
  395. ;        format, consult PT-Format.txt. Handy for spectrum analyzers. CH
  396. ;        equals the requested channel. (0-3)
  397. ;
  398. ;Field:        PPR_VoiceData+CH*PPRV_sizeof+PPRV_Volume.b
  399. ;Contents:    Volume of the current note. CH equals the requested channel.
  400. ;
  401. ;Field:        PPRM_VBR(PPR_MainData).l
  402. ;Contents:    Vectorbaseregister. If you'd like to fetch the VBR, do so and
  403. ;        store it here. ProPruner will then use it.
  404. ;
  405. ;    NOTEPLAYER FUNCTIONS AND MACROS:
  406. ;
  407. ;Macro:        PPRN_InitReg (Channel)
  408. ;Purpose:    Initializes A5 to point to the data area needed by the note-
  409. ;        player to perform it's functions.
  410. ;
  411. ;Macro:        PPRN_KillSound
  412. ;Purpose:    Kill all sound on all channels. (Will not have register
  413. ;        initialized!)
  414. ;
  415. ;Macro:        PPRN_KillCh
  416. ;Purpose:    Kill all sound on active channel.
  417. ;
  418. ;Macro:        PPRN_TrigWave (Wavestart, Wavelen)
  419. ;Purpose:    Trigs (immediately) the desired wave.
  420. ;
  421. ;Macro:        PPRN_SetWave (Wavestart, Wavelen)
  422. ;Purpose:    Trigs the wave the next time the repeat needs refreshing.
  423. ;
  424. ;Macro:        PPRN_SetVolume (Volume)
  425. ;Purpose:    Sets the volume for the active channel.
  426. ;
  427. ;Macro:        PPRN_SetRate (Rate)
  428. ;Purpose:    Sets the samplerate for the active channel.
  429. ;
  430. ;Macro:        PPRN_SetMVolL (MVolume)
  431. ;Purpose:    Sets mastervolume for left audiochannels. (Will not have
  432. ;        register initialized!)
  433. ;
  434. ;Macro:        PPRN_SetMVolR (MVolume)
  435. ;Purpose:    Sets mastervolume for tight audiochannels. (Will not have
  436. ;        register initialized!)
  437. ;
  438. ;Macro:        PPRN_Filter (State)
  439. ;Purpose:    Attempts to change the state of a lo-pass filter if such
  440. ;        exists on the output device.
  441. ;
  442. ;Function:    PPRN_MakeSound ()
  443. ;Purpose:    Does everything necessary to actually create sound. Will be
  444. ;        called about one frame _AFTER_ the relevant macros has been
  445. ;        executed.
  446. ;
  447. ;------------------------------------------------------------------------------
  448.  
  449. ; Set all undefined constants to default values. If you dont't like 'em, feel
  450. ; free to change, though you'll have to do it all over for each new version.
  451.  
  452.     ifnd PPR_Level6
  453. PPR_Level6    =    0            ; BOOL
  454.     endc
  455.  
  456.     ifnd PPR_SampleFile
  457. PPR_SampleFile    =    0            ; BOOL
  458.     endc
  459.  
  460.     ifnd PPR_PreDouble
  461. PPR_PreDouble    =    1            ; BOOL
  462.     endc
  463.  
  464.     ifnd PPR_MasterVol
  465. PPR_MasterVol    =    0            ; BOOL
  466.     endc
  467.  
  468.     ifnd PPR_PauseFuncs
  469. PPR_PauseFuncs    =    0            ; BOOL
  470.     endc
  471.  
  472.     ifnd PPR_WindFuncs
  473. PPR_WindFuncs    =    0            ; BOOL
  474.     endc
  475.  
  476.     ifnd PPR_Delta
  477. PPR_Delta    =    PPR_SampleFile        ; BOOL
  478.     endc
  479.  
  480.     ifnd PPR_Finetune
  481. PPR_Finetune    =    1            ; BOOL
  482.     endc
  483.  
  484.     ifnd PPR_CIA
  485. PPR_CIA        =    0            ; BOOL
  486.     endc
  487.  
  488.     ifnd PPR_68020
  489. PPR_68020    =    0            ; BOOL
  490.     endc
  491.  
  492.     ifnd PPR_PowerPatt
  493. PPR_PowerPatt    =    1            ; BOOL
  494.     endc
  495.  
  496.     ifnd PPR_NotePlayer
  497. PPR_NotePlayer    =    0            ; BOOL
  498.     endc
  499.  
  500.     ifnd PPR_Channels
  501. PPR_Channels    =    4            ; Range 0-4
  502.     endc
  503.  
  504. ; Module format definition
  505.  
  506.     RSRESET    ; INSTUMENT INFO
  507. PPRFI_Size    rs.w    1            ; Number of words
  508. PPRFI_Finetune    rs.b    1            ; Only lower 4 bits
  509. PPRFI_Volume    rs.b    1
  510. PPRFI_Repeat    rs.w    1
  511. PPRFI_RepLen    rs.w    1
  512. PPRFI_sizeof    rs.b    0
  513.  
  514.     RSRESET    ; MODULE STRUCTURE
  515. PPRF_Instr    rs.b    PPRFI_sizeof*31
  516. PPRF_Positions    rs.b    1
  517. PPRF_Data    rs.b    1            ; Set to $7f, see PT format
  518. PPRF_PosTab1    rs.b    128
  519. PPRF_PosTab2    rs.b    128
  520. PPRF_PosTab3    rs.b    128
  521. PPRF_PosTab4    rs.b    128
  522. PPRF_Patterns    rs.b    0            ; 128 bytes, offsets in notetab
  523. PPRF_NoteTabL    rs.l    1            ; Size of notetab
  524. PPRF_NoteTab    rs.l    0            ; Table of notes, as PT
  525. PPRF_Samples    rs.w    0            ; May be stripped
  526.  
  527.         ; FLAG set in PPRF_Data
  528. PPRF__Doubled    =    $80
  529.  
  530.     RSRESET    ; MAIN VARIABLES
  531. PPRM_SamplePtrs    rs.l    31
  532. PPRM_SongDatPtr    rs.l    1
  533. PPRM_LwtPtr    rs.l    1
  534. PPRM_OldIRQ    rs.l    1    ; Only for level 6 mode
  535. PPRM_VBR    rs.l    1    ; This will always be around.
  536. PPRM_PatternPos    rs.w    1
  537. PPRM_DMAConTmp    rs.w    1
  538. PPRM_Speed    rs.b    1
  539. PPRM_Counter    rs.b    1
  540. PPRM_SongPos    rs.b    1
  541. PPRM_PBreakPos    rs.b    1
  542. PPRM_PosJumpFl    rs.b    1
  543. PPRM_PBreakFl    rs.b    1
  544. PPRM_LowMask    rs.b    1
  545. PPRM_PtDelTime    rs.b    1
  546. PPRM_PtDelCount    rs.b    1
  547. PPRM_HiPattern    rs.b    1
  548. PPRM_Msg    rs.b    1
  549. PPRM_RestFlag    rs.b    1
  550. PPRM_PrePause    rs.b    1    ; Only for pausefuncs
  551. PPRM_pad    rs.b    3
  552. PPRM_sizeof    rs.b    0    ; Must be a multiple of 4!
  553.  
  554.     RSRESET    ; VOICE VARIABLES
  555. PPRV_PatternDat    rs.l    1    ; Copied from the pattern
  556. PPRV_SamplePtr    rs.l    1    ; Pointer to sampledata
  557. PPRV_LoopStart    rs.l    1    ; Pointer to start of loop
  558. PPRV_FunkPtr    rs.l    1    ; Sample pointer for funkrepeat
  559. PPRV_PlaySize    rs.w    1    ; Number of words that are actually played.
  560. PPRV_RepLen    rs.w    1    ; Repeat length in words
  561. PPRV_CurrPer    rs.w    1    ; Period currently playing
  562. PPRV_DMAMask    rs.w    1    ; DMA Mask for channel
  563. PPRV_TPDest    rs.w    1    ; Toneportamento destination
  564. PPRV_MasterVol    rs.w    1
  565. PPRV_TPDir    rs.b    1    ; Toneportamento direction
  566. PPRV_TPPara    rs.b    1    ; Current toneportamento parameter
  567. PPRV_Finetune    rs.b    1    ; Finetune and some flags
  568. PPRV_Volume    rs.b    1    ; Volume for channel
  569. PPRV_VibPara    rs.b    1    ; Current vibrato parameter
  570. PPRV_VibCount    rs.b    1    ; Vibrato count
  571. PPRV_TremPara    rs.b    1    ; Current tremolo parameter
  572. PPRV_TremCount    rs.b    1    ; Vibrato count
  573. PPRV_Control1    rs.b    1    ; Tremolo control / vibrato control
  574. PPRV_Control2    rs.b    1    ; Funkrepeat speed / glissando control
  575. PPRV_ArpCount    rs.b    1    ; Arpeggio count
  576. PPRV_SOffsPara    rs.b    1    ; Sample offset parameter
  577. PPRV_PLoopPos    rs.b    1    ; Pattern loop position
  578. PPRV_PLoopCount    rs.b    1    ; Pattern loop count
  579. PPRV_FunkDuh    rs.b    1    ; Some counter (waitcount for next funk?) for funkrepeat
  580. PPRV_Pad    rs.b    3
  581. PPRV_CurrNote    rs.b    1    ; Notenumber currently playing (Only POWERPATT)
  582. PPRV_pad    rs.b    1
  583. PPRV_sizeof    rs.b    0    ; Must be a multiple of 4!
  584.  
  585. ;------------------------------------------------------------------------------
  586. ;==                INIT                         ==
  587. ;------------------------------------------------------------------------------
  588.  
  589. PPR_Init    lea.l    PPR_MainData(pc),a4
  590.         move.l    a0,PPRM_SongDatPtr(a4)
  591.  
  592.     ifne PPR_SampleFile
  593.         move.l    a1,a2
  594.         lea.l    PPRM_SamplePtrs(a4),a3
  595.         moveq.l    #31-1,d0
  596. .Loop        move.l    (a2)+,d1
  597.         add.l    a1,d1
  598.         move.l    d1,(a3)+
  599.         dbf    d0,.Loop
  600.  
  601.         ifne PPR_Delta
  602.             move.l    124(a1),d0
  603.             beq.s    .NoDelta
  604.  
  605.             clr.l    124(a1)        ; Don't double-delta if called
  606.                         ; several times.
  607.             lea.l    128(a1),a1
  608.             moveq.l    #0,d1
  609. .DLoop            add.b    (a1),d1
  610.             move.b    d1,(a1)+
  611.             subq.l    #1,d0
  612.             bne.s    .DLoop
  613. .NoDelta
  614.         endc
  615.     endc
  616.  
  617.         lea.l    250(a0),a2
  618.         move.w    #511,d0
  619.         moveq.l    #0,d1
  620. .FindPatt    move.l    d1,d2
  621.         subq.w    #1,d0
  622. .FindPatt2    move.b    (a2)+,d1
  623.         cmp.w    d2,d1
  624.         bgt.s    .FindPatt
  625.         dbra    d0,.FindPatt2
  626.         move.b    d2,PPRM_HiPattern(a4)
  627.         addq    #1,d2            ; Patterns stored
  628.  
  629.     ifne PPR_PreDouble
  630.         move.b    PPRF_Data(a0),d3
  631.         and.b    #PPRF__Doubled,d3
  632.         bne.s    .WasDoubled
  633.  
  634.         move.l    d2,d3
  635.         lsl.l    #6,d3            ; *64 = bytes of patterns
  636.         subq.l    #1,d3
  637.  
  638.         move.l    a0,a1
  639.         lea.l    PPRF_Patterns(a1),a1
  640.  
  641. .DoubleLoop    move.w    (a1),d4
  642.         add.w    d4,d4
  643.         add.w    d4,d4
  644.         move.w    d4,(a1)+
  645.         dbf    d3,.DoubleLoop
  646.  
  647.         or.b    #PPRF__Doubled,PPRF_Data(a0)
  648. .WasDoubled
  649.     endc
  650.  
  651. ;Pattern conversion
  652.  
  653.     ifne PPR_PowerPatt
  654.         lea.l    PPRF_Patterns(a0),a1
  655.         moveq.l    #0,d0
  656.         move.b    PPRM_HiPattern(a4),d0
  657.         addq.l    #1,d0
  658.         lsl.l    #7,d0        ; * 128
  659.         add.l    d0,a1
  660.         move.l    (a1)+,d7
  661.         lsr.l    #2,d7
  662.         subq.l    #1,d7
  663.  
  664. ;D0- Temporary        A0- Modulepointer [!!!]
  665. ;D1- Temporary        A1- Notepointer
  666. ;D2- Temporary        A2- Periodtable
  667. ;D3-            A3- Temporary tab ptr
  668. ;D4- Loopcount        A4-
  669. ;D5- Sourcelong        A5-
  670. ;D6- Destlong        A6-
  671. ;D7- Loopcount        A7- [NA]
  672.  
  673.         lea.l    PPR_periodtable(pc),a2
  674. .PowerLoop    move.l    (a1),d5            ; Read source
  675.  
  676.         move.l    d5,d0
  677.         and.l    #$fff,d0
  678.         beq.s    .Skip
  679.         nop
  680. .Skip
  681.         move.l    d5,d0            ; Period
  682.         swap    d0
  683.         and.l    #$fff,d0
  684.         tst.l    d0
  685.         beq.s    .NoNote
  686.  
  687. .WasNote    move.l    a2,a3
  688.         moveq.l    #36-1,d4
  689.         moveq.l    #2,d1            ; Start at offset 2!!!
  690. .PerLoop    move.w    (a3)+,d2
  691.         cmp.w    d0,d2
  692.         beq.s    .FoundPer
  693.         addq.l    #2,d1
  694.         dbf    d4,.PerLoop
  695. .NoNote        moveq.l    #0,d1
  696. .FoundPer    move.b    d1,d6
  697.         lsl.w    #8,d6
  698.  
  699.         move.l    d5,d0            ; Instrument number
  700.         and.l    #$f0000000,d0
  701.         rol.l    #8,d0
  702.         move.l    d5,d1
  703.         and.l    #$0000f000,d1
  704.         lsl.l    #4,d1
  705.         swap    d1
  706.         or.w    d0,d1
  707.         move.b    d1,d6
  708.         lsl.l    #8,d6
  709.         lsl.l    #8,d6
  710.  
  711.         and.l    #$0fff,d5        ; Effect command
  712.         move.w    d5,d6
  713.         move.l    d6,(a1)+
  714.  
  715.         dbf    d7,.PowerLoop
  716.     endc
  717.  
  718.         moveq.l    #0,d2
  719.         move.b    PPRM_HiPattern(a4),d2
  720.         addq    #1,d2            ; Patterns stored
  721.         move.w    d2,d3
  722.         lsl.l    #7,d3
  723.         add.l    #766,d3
  724.         add.l    PPRM_SongDatPtr(a4),d3
  725.         move.l    d3,PPRM_LwtPtr(a4)
  726.  
  727.     ifeq PPR_SampleFile
  728.         lea.l    PPRM_SamplePtrs(a4),a1
  729.         moveq.l    #0,d2
  730.         move.b    PPRM_HiPattern(a4),d2
  731.         addq.l    #1,d2
  732.         lsl.l    #7,d2
  733.         add.l    #762,d2
  734.         add.l    (a0,d2.l),d2
  735.         add.l    PPRM_SongDatPtr(a4),d2
  736.         addq.l    #4,d2
  737.         move.l    d2,a2
  738.         moveq.l    #31-1,d0
  739. .SampleLoop    move.l    a2,(a1)+
  740.         moveq.l    #0,d1
  741.         move.w    (a0),d1
  742.         add.l    d1,d1
  743.         add.l    d1,a2
  744.         lea.l    8(a0),a0
  745.         dbra    d0,.SampleLoop
  746.     endc
  747.  
  748.         or.b    #2,$bfe001        ; Clear filter as default
  749.  
  750.         bsr.s    PPR_VoiceClear
  751.  
  752.     ifne PPR_CIA
  753.         move.b    #125,d0
  754.         bsr.s    PPR_SetBPM
  755.     endc
  756.  
  757.     ifeq PPR_NotePlayer
  758.         lea.l    PPR_VoiceData(pc),a6
  759.         move.w    #1,(PPRV_sizeof*0)+PPRV_DMAMask(a6)
  760.         move.w    #2,(PPRV_sizeof*1)+PPRV_DMAMask(a6)
  761.         move.w    #4,(PPRV_sizeof*2)+PPRV_DMAMask(a6)
  762.         move.w    #8,(PPRV_sizeof*3)+PPRV_DMAMask(a6)
  763.     endc
  764.  
  765.         clr.b    PPRM_RestFlag(a4)
  766.         clr.b    PPRM_SongPos(a4)
  767.         clr.w    PPRM_PatternPos(a4)
  768.  
  769.     ifne PPR_MasterVol
  770.         ifeq PPR_NotePlayer
  771.             lea.l    PPR_VoiceData(pc),a6
  772.             move.w    #64,(PPRV_sizeof*0)+PPRV_MasterVol(a6)
  773.             move.w    #64,(PPRV_sizeof*1)+PPRV_MasterVol(a6)
  774.             move.w    #64,(PPRV_sizeof*2)+PPRV_MasterVol(a6)
  775.             move.w    #64,(PPRV_sizeof*3)+PPRV_MasterVol(a6)
  776.         else
  777.             PPRN_SetMVolL 64
  778.             PPRN_SetMVolR 64
  779.         endc
  780.     endc
  781.  
  782.         move.b    #6,PPRM_Counter(a4)
  783.         move.b    #6,PPRM_Speed(a4)    ; Start playing
  784.  
  785.         rts
  786.  
  787. ;------------------------------------------------------------------------------
  788. ;==                END                         ==
  789. ;------------------------------------------------------------------------------
  790.  
  791. PPR_End        lea.l    PPR_MainData(pc),a4
  792.         move.b    #0,PPRM_Speed(a4)    ; Stop playing
  793.  
  794. PPR_VoiceClear
  795.     ifne PPR_NotePlayer
  796.         ifge PPR_Channels-1
  797.             PPRN_InitReg 0
  798.             PPRN_SetVolume #0
  799.         endc
  800.  
  801.         ifge PPR_Channels-2
  802.             PPRN_InitReg 1
  803.             PPRN_SetVolume #0
  804.         endc
  805.  
  806.         ifge PPR_Channels-3
  807.             PPRN_InitReg 2
  808.             PPRN_SetVolume #0
  809.         endc
  810.  
  811.         ifge PPR_Channels-4
  812.             PPRN_InitReg 3
  813.             PPRN_SetVolume #0
  814.         endc
  815.     else
  816.         lea.l    $dff096,a0
  817.         moveq.l    #0,d0
  818.     ifge PPR_Channels-1
  819.         move.w    #0,$12(a0)
  820.         and.w    #$0001,d0
  821.     endc
  822.     ifge PPR_Channels-2
  823.         move.w    #0,$22(a0)
  824.         and.w    #$0002,d0
  825.     endc
  826.     ifge PPR_Channels-3
  827.         move.w    #0,$32(a0)
  828.         and.w    #$0004,d0
  829.     endc
  830.     ifge PPR_Channels-4
  831.         move.w    #0,$42(a0)
  832.         and.w    #$0008,d0
  833.     endc
  834.         move.w    d0,(a0)
  835.     endc
  836.         rts
  837.  
  838. ;------------------------------------------------------------------------------
  839. ;==                SETMASTERVOL                     ==
  840. ;------------------------------------------------------------------------------
  841.     ifne PPR_MasterVol
  842. PPR_SetMasterVol
  843.         ifne PPR_NotePlayer
  844.             PPRN_SetMVolL d0
  845.             PPRN_SetMVolR d1
  846.         else
  847.             lea.l    PPR_VoiceData(pc),a0
  848.             move.w    d0,(PPRV_sizeof*0)+PPRV_MasterVol(a0)
  849.             move.w    d1,(PPRV_sizeof*1)+PPRV_MasterVol(a0)
  850.             move.w    d1,(PPRV_sizeof*2)+PPRV_MasterVol(a0)
  851.             move.w    d0,(PPRV_sizeof*3)+PPRV_MasterVol(a0)
  852.  
  853.             moveq.l    #0,d0
  854.  
  855.         ifge PPR_Channels-1
  856.             move.b    PPRV_Volume(a0),d0    ; Voice 1
  857.             mulu.w    PPRV_MasterVol(a0),d0
  858.             lsr.w    #6,d0
  859.             move.w    d0,$dff0a8
  860.             lea.l    PPRV_sizeof(a0),a0
  861.         endc
  862.  
  863.         ifge PPR_Channels-2
  864.             move.b    PPRV_Volume(a0),d0    ; Voice 2
  865.             mulu.w    PPRV_MasterVol(a0),d0
  866.             lsr.w    #6,d0
  867.             move.w    d0,$dff0b8
  868.             lea.l    PPRV_sizeof(a0),a0
  869.         endc
  870.  
  871.         ifge PPR_Channels-3
  872.             move.b    PPRV_Volume(a0),d0    ; Voice 3
  873.             mulu.w    PPRV_MasterVol(a0),d0
  874.             lsr.w    #6,d0
  875.             move.w    d0,$dff0c8
  876.             lea.l    PPRV_sizeof(a0),a0
  877.         endc
  878.  
  879.         ifge PPR_Channels-4
  880.             move.b    PPRV_Volume(a0),d0    ; Voice 4
  881.             mulu.w    PPRV_MasterVol(a0),d0
  882.             lsr.w    #6,d0
  883.             move.w    d0,$dff0d8
  884.             lea.l    PPRV_sizeof(a0),a0
  885.         endc
  886.  
  887.             rts
  888.  
  889. PPR_CALCVOL    macro    ;(Register)        ; Inits audio volume while
  890.         moveq.l    #0,\1            ;  scaling it using the master-
  891.         move.b    PPRV_Volume(a6),\1    ;  volume. Free feature trashes
  892.         mulu.w    PPRV_MasterVol(a6),\1    ;  your favourite data-
  893.         lsr.w    #6,\1            ;  register!!! 8)
  894.         move.b    \1,9(a5)
  895.         endm
  896.  
  897. PPR_CALCVOL2    macro    ;(Register)        ; Scaling register using the
  898.         mulu.w    PPRV_MasterVol(a6),\1    ;  mastervolume.
  899.         lsr.w    #6,\1
  900.         endm
  901.  
  902.         endc
  903.     endc
  904.  
  905. ;------------------------------------------------------------------------------
  906. ;==                PAUSE                         ==
  907. ;------------------------------------------------------------------------------
  908.     ifne PPR_PauseFuncs
  909. PPR_Pause    lea.l    PPR_MainData(pc),a4
  910.         move.b    PPRM_Speed(a4),PPRM_PrePause(a4)
  911.         bra.s    PPR_End
  912.  
  913. PPR_Continue    lea.l    PPR_MainData(pc),a4
  914.  
  915.     ifne PPR_NotePlayer
  916.         lea.l    PPR_VoiceData(pc),a0
  917.         moveq.l    #0,d0
  918.  
  919.     ifge PPR_Channels-1
  920.         PPRN_InitReg 0
  921.         move.b    PPRV_Volume(a0),d0
  922.         PPRN_SetVolume d0
  923.     endc
  924.  
  925.     ifge PPR_Channels-2
  926.         PPRN_InitReg 1
  927.         move.b    PPRV_Volume(a0),d0
  928.         PPRN_SetVolume d0
  929.     endc
  930.  
  931.     ifge PPR_Channels-3
  932.         PPRN_InitReg 2
  933.         move.b    PPRV_Volume(a0),d0
  934.         PPRN_SetVolume d0
  935.     endc
  936.  
  937.     ifge PPR_Channels-4
  938.         PPRN_InitReg 3
  939.         move.b    PPRV_Volume(a0),d0
  940.         PPRN_SetVolume d0
  941.     endc
  942.  
  943.     else
  944.             lea.l    PPR_VoiceData(pc),a6
  945.             lea.l    $dff0a0,a1
  946.             moveq.l    #0,d0
  947.  
  948.     ifge PPR_Channels-1
  949.             move.b    PPRV_Volume(a6),d0
  950.         ifne PPR_MasterVol
  951.             PPR_CALCVOL2    d0
  952.         endc
  953.             move.w    d0,$08(a1)
  954.             lea.l    PPRV_sizeof(a6),a6
  955.     endc
  956.  
  957.     ifge PPR_Channels-2
  958.             move.b    PPRV_Volume(a6),d0
  959.         ifne PPR_MasterVol
  960.             PPR_CALCVOL2    d0
  961.         endc
  962.             move.w    d0,$18(a1)
  963.             lea.l    PPRV_sizeof(a6),a6
  964.     endc
  965.  
  966.     ifge PPR_Channels-3
  967.             move.b    PPRV_Volume(a6),d0
  968.         ifne PPR_MasterVol
  969.             PPR_CALCVOL2    d0
  970.         endc
  971.             move.w    d0,$28(a1)
  972.             lea.l    PPRV_sizeof(a6),a6
  973.     endc
  974.  
  975.     ifge PPR_Channels-4
  976.             move.b    PPRV_Volume(a6),d0
  977.         ifne PPR_MasterVol
  978.             PPR_CALCVOL2    d0
  979.         endc
  980.             move.w    d0,$38(a1)
  981.     endc
  982.     endc
  983.  
  984.         move.b    PPRM_PrePause(a4),PPRM_Speed(a4)
  985.  
  986.         rts
  987.     endc
  988.  
  989. ;------------------------------------------------------------------------------
  990. ;==                FORWARD/REWIND                     ==
  991. ;------------------------------------------------------------------------------
  992.     ifne PPR_WindFuncs
  993. PPR_Forward    lea.l    PPR_MainData(pc),a4
  994.  
  995.         bsr.w    PPR_VoiceClear
  996.  
  997.         move.w    #256,PPRM_PatternPos(a4)
  998.         move.b    PPRM_Speed(a4),PPRM_Counter(a4)
  999.  
  1000.         moveq.l    #0,d0
  1001.         rts
  1002.  
  1003. PPR_Rewind    lea.l    PPR_MainData(pc),a4
  1004.         bsr.w    PPR_VoiceClear
  1005.  
  1006.         move.b    PPRM_SongPos(a4),d0
  1007.         tst.b    d0
  1008.         bne.s    .not0
  1009.  
  1010.         move.l    PPRM_SongDatPtr(a4),a0
  1011.         move.b    PPRF_Positions(a0),PPRM_SongPos(a4)
  1012.         sub.b    #2,PPRM_SongPos(a4)
  1013.         bra.s    .ok
  1014.  
  1015. .not0        cmp.b    #1,d0
  1016.         bne.s    .not1
  1017.  
  1018.         move.l    PPRM_SongDatPtr(a4),a0
  1019.         move.b    PPRF_Positions(a0),PPRM_SongPos(a4)
  1020.         sub.b    #1,PPRM_SongPos(a4)
  1021.         bra.s    .ok
  1022.  
  1023. .not1        sub.b    #2,PPRM_SongPos(a4)
  1024. .ok        move.w    #256,PPRM_PatternPos(a4)
  1025.         move.b    PPRM_Speed(a4),PPRM_Counter(a4)
  1026.  
  1027.         moveq.l    #0,d0
  1028.         rts
  1029.     endc
  1030.  
  1031. ;------------------------------------------------------------------------------
  1032. ;==                MUSIC                         ==
  1033. ;;-----------------------------------------------------------------------------
  1034. ;A0 - Pattern pointer. (...?)
  1035. ;A1 -
  1036. ;A2 -
  1037. ;A3 -
  1038. ;A4 - Pointer to main-variables
  1039. ;A5 - Pointer to audio-hardware
  1040. ;A6 - Pointer to voice-variables
  1041. ;------------------------------------------------------------------------------
  1042. PPR_Music
  1043.     ifne PPR_NotePlayer
  1044.         bsr.w    PPRN_MakeSound
  1045.     endc
  1046.  
  1047.         lea.l    PPR_MainData(pc),a4
  1048.         addq.b    #1,PPRM_Counter(a4)
  1049.         move.b    PPRM_Speed(a4),d1    ; Module halted?
  1050.         beq.w    PPR_return
  1051.         move.b    PPRM_Counter(a4),d0
  1052.         cmp.b    d1,d0
  1053.         blo.w    PPR_nonewnote
  1054.         clr.b    PPRM_Counter(a4)
  1055.         tst.b    PPRM_PtDelCount(a4)    ; Pattern delayed?
  1056.         beq.w    PPR_getnewnote
  1057.  
  1058.         pea.l    PPR_dskip(pc)
  1059.         bra.w    PPR_nonewallchannels
  1060.  
  1061. PPR_WAITDMA    macro
  1062.         bsr.w    PPR_DMAWait
  1063.         endm
  1064.  
  1065.     ifeq PPR_Level6
  1066. PPR_DMAWait
  1067.         lea.l    $bfe001,a0
  1068.  
  1069.     rept    (715909/(50*312))*2
  1070.         tst.b    (a0)
  1071.     endr
  1072.         rts
  1073.     endc
  1074.  
  1075. PPR_PERNOP    macro
  1076.     ifne PPR_NotePlayer
  1077.         PPRN_SetRate PPRV_CurrPer(a6)
  1078.     else
  1079.         move.w    PPRV_CurrPer(a6),6(a5)
  1080.     endc
  1081.         endm
  1082.  
  1083. PPR_nonewnote    pea.l    PPR_nonewposyet(pc)
  1084.         bra.w    PPR_nonewallchannels
  1085.  
  1086. PPR_nonewallchannels
  1087.         ; Updates effects, and that's basically it.
  1088.  
  1089.     ifeq PPR_NotePlayer
  1090.             lea.l    $dff090,a5
  1091.             lea.l    PPR_VoiceData-PPRV_sizeof(pc),a6
  1092.  
  1093.         ifge PPR_Channels-1
  1094.             ifeq PPR_Channels-1
  1095.                 bra.w    PPR_ChkEfxEvery
  1096.             else
  1097.                 bsr.w    PPR_ChkEfxEvery
  1098.             endc
  1099.         endc
  1100.  
  1101.         ifge PPR_Channels-2
  1102.             ifeq PPR_Channels-2
  1103.                 bra.w    PPR_ChkEfxEvery
  1104.             else
  1105.                 bsr.w    PPR_ChkEfxEvery
  1106.             endc
  1107.         endc
  1108.  
  1109.         ifge PPR_Channels-3
  1110.             ifeq PPR_Channels-3
  1111.                 bra.w    PPR_ChkEfxEvery
  1112.             else
  1113.                 bsr.w    PPR_ChkEfxEvery
  1114.             endc
  1115.         endc
  1116.  
  1117.         ifge PPR_Channels-4
  1118.             ifeq PPR_Channels-4
  1119.                 bra.w    PPR_ChkEfxEvery
  1120.             else
  1121.                 bsr.w    PPR_ChkEfxEvery
  1122.             endc
  1123.         endc
  1124.     else
  1125.             lea.l    PPR_VoiceData-PPRV_sizeof(pc),a6
  1126.  
  1127.         ifge PPR_Channels-1
  1128.             PPRN_InitReg 0
  1129.             ifeq PPR_Channels-1
  1130.                 bra.w    PPR_ChkEfxEvery
  1131.             else
  1132.                 bsr.w    PPR_ChkEfxEvery
  1133.             endc
  1134.         endc
  1135.  
  1136.         ifge PPR_Channels-2
  1137.             PPRN_InitReg 1
  1138.             ifeq PPR_Channels-2
  1139.                 bra.w    PPR_ChkEfxEvery
  1140.             else
  1141.                 bsr.w    PPR_ChkEfxEvery
  1142.             endc
  1143.         endc
  1144.  
  1145.         ifge PPR_Channels-3
  1146.             PPRN_InitReg 2
  1147.             ifeq PPR_Channels-3
  1148.                 bra.w    PPR_ChkEfxEvery
  1149.             else
  1150.                 bsr.w    PPR_ChkEfxEvery
  1151.             endc
  1152.         endc
  1153.  
  1154.         ifge PPR_Channels-4
  1155.             PPRN_InitReg 3
  1156.             ifeq PPR_Channels-4
  1157.                 bra.w    PPR_ChkEfxEvery
  1158.             else
  1159.                 bsr.w    PPR_ChkEfxEvery
  1160.             endc
  1161.         endc
  1162.     endc
  1163.  
  1164.         rts
  1165.  
  1166. PPR_getnewnote    ; Gets new notes for all channels.
  1167.  
  1168.         move.l    PPRM_SongDatPtr(a4),a0
  1169.         move.l    a0,a3
  1170.         lea.l    122(a0),a2    ;pattpo
  1171.         lea.l    762(a0),a0    ;patterndata
  1172.         clr.w    PPRM_DMAConTmp(a4)
  1173.  
  1174.         lea.l    PPR_VoiceData-PPRV_sizeof(pc),a6
  1175.  
  1176.     ifeq PPR_NotePlayer
  1177.         lea.l    $dff090,a5
  1178.  
  1179.         ifgt PPR_Channels-0
  1180.             bsr.s    PPR_dovoice
  1181.         endc
  1182.  
  1183.         ifgt PPR_Channels-1
  1184.             bsr.s    PPR_dovoice
  1185.         endc
  1186.  
  1187.         ifgt PPR_Channels-2
  1188.             bsr.s    PPR_dovoice
  1189.         endc
  1190.  
  1191.         ifgt PPR_Channels-3
  1192.             bsr.s    PPR_dovoice
  1193.         endc
  1194.     else
  1195.         ifgt PPR_Channels-0
  1196.             PPRN_InitReg 0
  1197.             bsr.s    PPR_dovoice
  1198.         endc
  1199.  
  1200.         ifgt PPR_Channels-1
  1201.             PPRN_InitReg 1
  1202.             bsr.s    PPR_dovoice
  1203.         endc
  1204.  
  1205.         ifgt PPR_Channels-2
  1206.             PPRN_InitReg 2
  1207.             bsr.s    PPR_dovoice
  1208.         endc
  1209.  
  1210.         ifgt PPR_Channels-3
  1211.             PPRN_InitReg 3
  1212.             bsr.s    PPR_dovoice
  1213.         endc
  1214.     endc
  1215.  
  1216.         bra.w    PPR_setdma
  1217.  
  1218. PPR_dovoice    ; Fetches next step in pattern and processes it.
  1219.  
  1220.         moveq.l    #0,d0
  1221.         moveq.l    #0,d1
  1222.         move.b    PPRM_SongPos(a4),d0
  1223.         lea.l    128(a2),a2
  1224.         move.b    (a2,d0.w),d1
  1225.         move.w    PPRM_PatternPos(a4),d2
  1226.         lsl    #7,d1            ; *128
  1227.         lsr.w    #1,d2
  1228.         add.w    d2,d1
  1229.  
  1230.     ifeq PPR_NotePlayer
  1231.         lea.l    $10(a5),a5        ; Next audio register
  1232.     endc
  1233.  
  1234.         lea.l    PPRV_sizeof(a6),a6
  1235.  
  1236.         tst.l    PPRV_PatternDat(a6)
  1237.         bne.w    PPR_plvskip
  1238.         PPR_PERNOP
  1239.  
  1240. PPR_plvskip    move.w    (a0,d1.w),d1
  1241.  
  1242.         move.l    PPRM_LwtPtr(a4),a1
  1243.  
  1244.         ; Fetches patterndata
  1245.     ifeq PPR_PreDouble
  1246.         ifeq PPR_68020
  1247.             add.w    d1,d1
  1248.             add.w    d1,d1
  1249.             move.l    (a1,d1.w),PPRV_PatternDat(a6)
  1250.         else
  1251.             move.l    (0,a1,d1.w*4),PPRV_PatternDat(a6)
  1252.         endc
  1253.     else
  1254.         move.l    (a1,d1.w),PPRV_PatternDat(a6); The step-info (as PT!)
  1255.     endc
  1256.  
  1257.     ifeq PPR_PowerPatt
  1258.         move.b    PPRV_PatternDat+2(a6),d2
  1259.         and.l    #$f0,d2
  1260.         lsr.b    #4,d2
  1261.         move.b    PPRV_PatternDat(a6),d0
  1262.         and.b    #$f0,d0
  1263.         or.b    d0,d2
  1264.     else
  1265.         moveq.l    #0,d2
  1266.         move.b    PPRV_PatternDat+1(a6),d2; Instrument number
  1267.     endc
  1268.  
  1269.         beq.b    PPR_setregs        ; Retrig instrument?
  1270.  
  1271.         moveq.l    #0,d3
  1272.         lea.l    PPRM_SamplePtrs(a4),a1
  1273.         subq    #1,d2
  1274.         move    d2,d4
  1275.  
  1276.     ifne PPR_68020
  1277.         move.l    (0,a1,d2.l*4),(PPRV_SamplePtr,a6); Samplepointer
  1278.     else
  1279.         add    d2,d2
  1280.         add    d2,d2
  1281.         move.l    (a1,d2.l),PPRV_SamplePtr(a6)
  1282.     endc
  1283.  
  1284.         lsl.w    #3,d4
  1285.         move.w    PPRFI_Size(a3,d4.w),PPRV_PlaySize(a6)
  1286.         move.w    PPRFI_Finetune(a3,d4.w),PPRV_Finetune(a6)
  1287.         move.l    PPRV_SamplePtr(a6),d2        ; get start
  1288.         move.w    PPRFI_Repeat(a3,d4.w),d3    ; get repeat
  1289.         beq.s    PPR_noloop
  1290.         move.w    d3,d0                ; get repeat
  1291.         add.w    d3,d3
  1292.         add.l    d3,d2                ; add repeat
  1293.         add.w    PPRFI_RepLen(a3,d4.w),d0    ; add replen
  1294.         move.w    d0,PPRV_PlaySize(a6)
  1295.  
  1296. PPR_noloop    move.l    d2,PPRV_LoopStart(a6)
  1297.         move.l    d2,PPRV_FunkPtr(a6)
  1298.         move.w    PPRFI_RepLen(a3,d4.w),PPRV_RepLen(a6)    ; save replen
  1299.  
  1300.     ifeq PPR_NotePlayer
  1301.         ifne PPR_MasterVol
  1302.             PPR_CALCVOL    d0
  1303.         else
  1304.             move.b    PPRV_Volume(a6),9(a5)    ; set volume
  1305.         endc
  1306.     else
  1307.         PPRN_SetVolume PPRV_Volume(a6)
  1308.     endc
  1309.  
  1310. PPR_setregs
  1311.     ifeq PPR_PowerPatt
  1312.         move.w    PPRV_PatternDat(a6),d0
  1313.         and.w    #$0fff,d0
  1314.     else
  1315.         move.b    PPRV_PatternDat(a6),d0
  1316.         and.w    #$00ff,d0
  1317.     endc
  1318.  
  1319.         beq.w    PPR_ChkEfxSometime    ; if no note
  1320.  
  1321.         move.w    PPRV_PatternDat+2(a6),d0; Effectcommands to execute
  1322.                         ; before setting period for
  1323.                         ; new notes.
  1324.  
  1325.     ifne PPR_Finetune
  1326.         and.w    #$0ff0,d0
  1327.         cmp.w    #$0e50,d0
  1328.         beq.s    PPR_dosetfinetune
  1329.     endc
  1330.  
  1331.         and.w    #$0f00,d0
  1332.         cmp.w    #$0300,d0        ; toneportamento
  1333.         beq.s    PPR_chktoneporta
  1334.         cmp.w    #$0500,d0
  1335.         beq.s    PPR_chktoneporta
  1336.         cmp.w    #$0900,d0        ; sample offset
  1337.         bne.s    PPR_setperiod
  1338.  
  1339.         pea.l    PPR_setperiod(pc)
  1340.         bra.w    PPR_ChkEfxSometime
  1341.  
  1342. PPR_chktoneporta
  1343.  
  1344.         pea.l    PPR_ChkEfxSometime(pc)
  1345.         bra.w    PPR_settoneporta
  1346.  
  1347.     ifne PPR_Finetune
  1348. PPR_dosetfinetune
  1349.         bsr.w    PPR_setfinetune
  1350.     endc
  1351.  
  1352. PPR_setperiod    ; Set period for channel.
  1353.  
  1354. ;        movem.l    d1/a1,-(sp)
  1355.  
  1356.     ifeq PPR_PowerPatt
  1357.         move.w    PPRV_PatternDat(a6),d1
  1358.         and.w    #$0fff,d1
  1359.  
  1360.         ifeq PPR_Finetune
  1361.             move.w    d1,PPRV_CurrPer(a6)
  1362.         else
  1363.  
  1364. PPR_setperiod2
  1365.             lea.l    PPR_periodtable(pc),a1
  1366.             moveq.l    #36,d7
  1367. PPR_ftuloop        cmp.w    (a1)+,d1
  1368.             bhs.s    PPR_ftufound
  1369.             dbra    d7,PPR_ftuloop
  1370. PPR_ftufound
  1371.             moveq.l    #0,d1
  1372.             move.b    PPRV_Finetune(a6),d1
  1373.             lsl.l    #7,d1        ; *64*2
  1374.  
  1375.             move.w    -2(a1,d1.w),PPRV_CurrPer(a6)
  1376.         endc
  1377.     else    ; If powerpatterns were enabled...
  1378.         move.b    PPRV_PatternDat(a6),d1
  1379.         and.l    #$00ff,d1
  1380.  
  1381.         ifeq PPR_Finetune
  1382.             lea.l    PPR_periodtable-2(pc),a1
  1383.             move.w    (a1,d1.w),PPRV_CurrPer(a6)
  1384.             move.b    PPRV_PatternDat(a6),PPRV_CurrNote(a6)
  1385.         else
  1386.  
  1387. PPR_setperiod2        move.b    PPRV_PatternDat(a6),PPRV_CurrNote(a6)
  1388.  
  1389.             lea.l    PPR_periodtable-2(pc),a1
  1390. PPR_ftu            moveq.l    #0,d0
  1391.             move.b    PPRV_Finetune(a6),d0    ; Finetune value
  1392.             lsl.l    #7,d0        ; *64*2
  1393.             add.l    d0,a1
  1394.  
  1395.             move.w    (a1,d1.w),PPRV_CurrPer(a6)
  1396.         endc
  1397.     endc
  1398.  
  1399. ;        movem.l    (sp)+,d1/a1
  1400.  
  1401.         move.w    PPRV_PatternDat+2(a6),d0; Effectcommands to execute
  1402.         and.w    #$0ff0,d0        ; after periodsetting for new
  1403.         cmp.w    #$0ed0,d0        ; notes. (notedelay)
  1404.         beq.w    PPR_ChkEfxSometime
  1405.  
  1406.     ifeq PPR_NotePlayer
  1407.         move.w    PPRV_DMAMask(a6),$dff096; Disable DMA for this channel
  1408.     endc
  1409.  
  1410.         btst    #2,PPRV_Control1(a6)
  1411.         bne.s    PPR_vibnoc
  1412.  
  1413.         clr.b    PPRV_VibCount(a6)
  1414.  
  1415. PPR_vibnoc    btst    #6,PPRV_Control1(a6)
  1416.         bne.s    PPR_trenoc
  1417.         clr.b    PPRV_TremCount(a6)
  1418.  
  1419. PPR_trenoc
  1420.     ifeq PPR_NotePlayer
  1421.         move.l    PPRV_SamplePtr(a6),(a5)        ; set start
  1422.         move.w    PPRV_PlaySize(a6),4(a5)        ; set length
  1423.         move.w    PPRV_CurrPer(a6),6(a5)        ; set period
  1424.         move.w    PPRV_DMAMask(a6),d0
  1425.         or.w    d0,PPRM_DMAConTmp(a4)        ; Order trig of note
  1426.     else
  1427.         PPRN_TrigWave PPRV_SamplePtr(a6),PPRV_PlaySize(a6)
  1428.         PPRN_SetRate PPRV_CurrPer(a6)
  1429.     endc
  1430.         bra.w    PPR_ChkEfxSometime
  1431.  
  1432. PPR_setdma    ; Trig new samples with respect to DMA cycles.
  1433.  
  1434.     ifeq PPR_NotePlayer
  1435.             or.w    #$8000,PPRM_DMAConTmp(a4)
  1436.  
  1437.         ifne PPR_Level6 ;then
  1438.             lea.l    $bfd000,a3
  1439.             move.l    PPRM_VBR(a4),a1
  1440.             move.b    #$7f,$d00(a3)
  1441.             move.w    #$2000,$dff09c
  1442.             move.w    #$a000,$dff09a
  1443.             move.l    $78(a1),PPRM_OldIRQ(a4)
  1444.             lea.l    PPR_irq1(pc),a2
  1445.             move.l    a2,$78(a1)
  1446.             moveq.l    #0,d0
  1447.             move.b    d0,$e00(a3)
  1448.             move.b    #$a8,$400(a3)
  1449.             move.b    d0,$500(a3)
  1450.             move.b    #$11,$e00(a3)
  1451.             move.b    #$81,$d00(a3)
  1452.             bra.w    PPR_dskip
  1453.         else
  1454.             PPR_WAITDMA
  1455.         endc
  1456.  
  1457.         ifne PPR_Level6 ;then
  1458. PPR_irq1        movem.l    a0/a1/a4,-(sp)
  1459.             lea.l    PPR_MainData(pc),a4
  1460.             tst.b    $bfdd00
  1461.             move.w    PPRM_DMAConTmp(a4),$dff096; Reset Paula
  1462.             move.w    #$2000,$dff09c
  1463.  
  1464.             move.l    PPRM_VBR(a4),a0
  1465.             lea.l    PPR_irq2(pc),a1
  1466.             move.l    a1,$78(a0)
  1467.             movem.l    (sp)+,a0/a1/a4
  1468.  
  1469.             rte
  1470.  
  1471.         else
  1472. PPR_Dummy01        move.w    PPRM_DMAConTmp(a4),$dff096; Reset Paula
  1473.             PPR_WAITDMA
  1474.         endc
  1475.  
  1476.         ifne PPR_Level6 ;then
  1477. PPR_irq2        tst.b    $bfdd00
  1478.             movem.l    a4-a6,-(a7)
  1479.             lea.l    PPR_MainData(pc),a4
  1480.         endc
  1481.  
  1482.         lea.l    $dff0a0,a5
  1483.         lea.l    PPR_VoiceData(pc),a6
  1484.  
  1485.     ifge PPR_Channels-1
  1486.         move.l    (PPRV_sizeof*0)+PPRV_LoopStart(a6),$00(a5)
  1487.         move.w    (PPRV_sizeof*0)+PPRV_RepLen(a6),$04(a5)
  1488.     endc
  1489.     ifge PPR_Channels-2
  1490.         move.l    (PPRV_sizeof*1)+PPRV_LoopStart(a6),$10(a5)
  1491.         move.w    (PPRV_sizeof*1)+PPRV_RepLen(a6),$14(a5)
  1492.     endc
  1493.     ifge PPR_Channels-3
  1494.         move.l    (PPRV_sizeof*2)+PPRV_LoopStart(a6),$20(a5)
  1495.         move.w    (PPRV_sizeof*2)+PPRV_RepLen(a6),$24(a5)
  1496.     endc
  1497.     ifge PPR_Channels-4
  1498.         move.l    (PPRV_sizeof*3)+PPRV_LoopStart(a6),$30(a5)
  1499.         move.w    (PPRV_sizeof*3)+PPRV_RepLen(a6),$34(a5)
  1500.     endc
  1501.  
  1502.         ifne PPR_Level6 ;then
  1503.             move.b    #0,$bfde00
  1504.             move.b    #$7f,$bfdd00
  1505.             move.l    PPRM_VBR(a4),a5
  1506.             move.l    PPRM_OldIRQ(a4),$78(a5)
  1507.             move.w    #$2000,$dff09c
  1508.             movem.l    (a7)+,a4-a6
  1509.             rte
  1510.         endc
  1511.     else
  1512.     ifge PPR_Channels-1
  1513.         lea.l    PPR_VoiceData(pc),a6
  1514.         PPRN_InitReg 0
  1515.         PPRN_SetWave PPRV_LoopStart(a6),PPRV_RepLen(a6)
  1516.     endc
  1517.     ifge PPR_Channels-2
  1518.         PPRN_InitReg 1
  1519.         PPRN_SetWave PPRV_LoopStart(a6),PPRV_RepLen(a6)
  1520.     endc
  1521.     ifge PPR_Channels-3
  1522.         PPRN_InitReg 2
  1523.         PPRN_SetWave PPRV_LoopStart(a6),PPRV_RepLen(a6)
  1524.     endc
  1525.     ifge PPR_Channels-4
  1526.         PPRN_InitReg 3
  1527.         PPRN_SetWave PPRV_LoopStart(a6),PPRV_RepLen(a6)
  1528.     endc
  1529.     endc
  1530.  
  1531. PPR_dskip    ; Do things concerning the next patternstep.
  1532.  
  1533.         addq.w    #4,PPRM_PatternPos(a4)
  1534.         move.b    PPRM_PtDelTime(a4),d0
  1535.         beq.s    PPR_dskc        ; No pending delay...
  1536.  
  1537.         move.b    d0,PPRM_PtDelCount(a4)
  1538.         clr.b    PPRM_PtDelTime(a4)
  1539.  
  1540. PPR_dskc    tst.b    PPRM_PtDelCount(a4)    ; No delaycount...
  1541.         beq.s    PPR_dska
  1542.  
  1543.         subq.b    #1,PPRM_PtDelCount(a4)    ; Sub counter...
  1544.         beq.s    PPR_dska        ; Release pattern...
  1545.  
  1546.         subq.w    #4,PPRM_PatternPos(a4)
  1547.  
  1548. PPR_dska    tst.b    PPRM_PBreakFl(a4)
  1549.         beq.s    PPR_nnpysk
  1550.  
  1551.         sf    PPRM_PBreakFl(a4)
  1552.         moveq.l    #0,d0
  1553.         move.b    PPRM_PBreakPos(a4),d0
  1554.         clr.b    PPRM_PBreakPos(a4)
  1555.         add.w    d0,d0
  1556.         add.w    d0,d0
  1557.         move.w    d0,PPRM_PatternPos(a4)
  1558.  
  1559. PPR_nnpysk    cmp.w    #256,PPRM_PatternPos(a4)
  1560.         blo.s    PPR_nonewposyet
  1561.  
  1562. PPR_nextposition
  1563.         ; Fetches the next position.
  1564.  
  1565.         moveq.l    #0,d0
  1566.         move.b    PPRM_PBreakPos(a4),d0
  1567.         add.w    d0,d0
  1568.         add.w    d0,d0
  1569.         move.w    d0,PPRM_PatternPos(a4)
  1570.         clr.b    PPRM_PBreakPos(a4)
  1571.         clr.b    PPRM_PosJumpFl(a4)
  1572.         addq.b    #1,PPRM_SongPos(a4)
  1573.         and.b    #$7f,PPRM_SongPos(a4)
  1574.         move.b    PPRM_SongPos(a4),d1
  1575.         move.l    PPRM_SongDatPtr(a4),a0
  1576.         cmp.b    PPRF_Positions(a0),d1
  1577.         blo.s    PPR_nonewposyet
  1578.         clr.b    PPRM_SongPos(a4)
  1579.         st.b    PPRM_RestFlag(a4)
  1580.  
  1581. PPR_nonewposyet    tst.b    PPRM_PosJumpFl(a4)
  1582.         bne.s    PPR_nextposition
  1583.  
  1584. PPR_return    rts
  1585.  
  1586. ;------------------------------------------------------------------------------
  1587. ;Effectcommands which needs to be called every frame.
  1588. ;------------------------------------------------------------------------------
  1589.  
  1590. PPR_ChkEfxEvery
  1591.     ifeq PPR_NotePlayer
  1592.         lea.l    $10(a5),a5
  1593.     endc
  1594.  
  1595.         lea.l    PPRV_sizeof(a6),a6
  1596.  
  1597.         tst.b    PPRM_PtDelCount(a4)
  1598.         beq.s    .NoDelay
  1599.  
  1600.         tst.b    PPRM_Counter(a4)
  1601.         bne.s    .NoDelay
  1602.  
  1603.         ; This has to be done in order to manually take care of the
  1604.         ; steps when the pattern is delayed.
  1605.  
  1606.         bsr.s    PPR_ChkEfxSometime
  1607.  
  1608. .NoDelay    bsr.w    PPR_updatefunk
  1609.  
  1610.         move.w    PPRV_PatternDat+2(a6),d0
  1611.         bne.w    .WasEffect
  1612.  
  1613.         PPR_PERNOP
  1614.         rts
  1615.  
  1616. .WasEffect    lsr.w    #8-2,d0            ; Get cmd-byte and *4.
  1617.         and.w    #$f<<2,d0
  1618.         lea.l    PPR_EfxEvery(pc),a1
  1619.         add.l    (a1,d0.w),a1
  1620.         jsr    (a1)
  1621.  
  1622.         rts
  1623.  
  1624. PPR_EfxEvery    dc.l    PPR_arpeggio-PPR_EfxEvery            ; 0
  1625.         dc.l    PPR_portaup-PPR_EfxEvery            ; 1
  1626.         dc.l    PPR_portadown-PPR_EfxEvery            ; 2
  1627.         dc.l    PPR_toneportamento-PPR_EfxEvery            ; 3
  1628.         dc.l    PPR_vibrato-PPR_EfxEvery            ; 4
  1629.         dc.l    PPR_toneplusvolslide-PPR_EfxEvery        ; 5
  1630.         dc.l    PPR_vibratoplusvolslide-PPR_EfxEvery        ; 6
  1631.         dc.l    PPR_tremolo-PPR_EfxEvery            ; 7
  1632.         dc.l    PPR_return-PPR_EfxEvery                ; 8
  1633.         dc.l    PPR_return-PPR_EfxEvery                ; 9
  1634.         dc.l    PPR_volumeslide-PPR_EfxEvery            ; A
  1635.         dc.l    PPR_return-PPR_EfxEvery                ; B
  1636.         dc.l    PPR_return-PPR_EfxEvery                ; C
  1637.         dc.l    PPR_return-PPR_EfxEvery                ; D
  1638.         dc.l    PPR_ChkExtEvery-PPR_EfxEvery            ; Ex
  1639.         dc.l    PPR_return-PPR_EfxEvery                ; F
  1640.  
  1641. ;------------------------------------------------------------------------------
  1642. ;Effectcommands which needs to be called every time a new note is started.
  1643. ;------------------------------------------------------------------------------
  1644.  
  1645. PPR_ChkEfxSometime
  1646.         ; Effectcommands to execute only the first frame...
  1647.  
  1648.         bsr.w    PPR_updatefunk        ; Why here?!?
  1649.  
  1650.         move.b    PPRV_PatternDat+2(a6),d0
  1651.         and.w    #$f,d0
  1652.         lsl.w    #2,d0            ; *4
  1653.         lea.l    PPR_EfxSometime(pc),a1
  1654.         add.l    (a1,d0.w),a1
  1655.         jsr    (a1)
  1656.  
  1657.         PPR_PERNOP            ; Necessary?
  1658.         rts
  1659.  
  1660. PPR_EfxSometime    dc.l    PPR_arpinit-PPR_EfxSometime            ; 0
  1661.         dc.l    PPR_return-PPR_EfxSometime            ; 1
  1662.         dc.l    PPR_return-PPR_EfxSometime            ; 2
  1663.         dc.l    PPR_return-PPR_EfxSometime            ; 3
  1664.         dc.l    PPR_return-PPR_EfxSometime            ; 4
  1665.         dc.l    PPR_return-PPR_EfxSometime            ; 5
  1666.         dc.l    PPR_return-PPR_EfxSometime            ; 6
  1667.         dc.l    PPR_return-PPR_EfxSometime            ; 7
  1668.         dc.l    PPR_syncval-PPR_EfxSometime            ; 8
  1669.         dc.l    PPR_sampleoffset-PPR_EfxSometime        ; 9
  1670.         dc.l    PPR_return-PPR_EfxSometime            ; A
  1671.         dc.l    PPR_positionjump-PPR_EfxSometime        ; B
  1672.         dc.l    PPR_volumechange-PPR_EfxSometime        ; C
  1673.         dc.l    PPR_patternbreak-PPR_EfxSometime        ; D
  1674.         dc.l    PPR_ChkExtSometime-PPR_EfxSometime        ; Ex
  1675.         dc.l    PPR_setspeed-PPR_EfxSometime            ; F
  1676.  
  1677. ;------------------------------------------------------------------------------
  1678. ;Extended effectcommands are called each frame.
  1679. ;------------------------------------------------------------------------------
  1680.  
  1681. PPR_ChkExtEvery
  1682.         ; Extended effectcommands called each frame...
  1683.  
  1684.         move.b    PPRV_PatternDat+3(a6),d0
  1685.         lsr.w    #4-2,d0            ; *4
  1686.         and.w    #$f<<2,d0
  1687.         lea.l    PPR_ExtEvery(pc),a1
  1688.         add.l    (a1,d0.w),a1
  1689.         jsr    (a1)
  1690.  
  1691.         rts
  1692.  
  1693. PPR_ExtEvery    dc.l    PPR_return-PPR_ExtEvery                ; 0
  1694.         dc.l    PPR_return-PPR_ExtEvery                ; 1
  1695.         dc.l    PPR_return-PPR_ExtEvery                ; 2
  1696.         dc.l    PPR_return-PPR_ExtEvery                ; 3
  1697.         dc.l    PPR_return-PPR_ExtEvery                ; 4
  1698.     ifne PPR_Finetune
  1699.         dc.l    PPR_setfinetune-PPR_ExtEvery            ; 5
  1700.     else
  1701.         dc.l    PPR_return-PPR_ExtEvery                ; 5
  1702.     endc
  1703.         dc.l    PPR_return-PPR_ExtEvery                ; 6
  1704.         dc.l    PPR_return-PPR_ExtEvery                ; 7
  1705.         dc.l    PPR_return-PPR_ExtEvery                ; 8
  1706.         dc.l    PPR_retrignote-PPR_ExtEvery            ; 9
  1707.         dc.l    PPR_return-PPR_ExtEvery                ; A
  1708.         dc.l    PPR_return-PPR_ExtEvery                ; B
  1709.         dc.l    PPR_notecut-PPR_ExtEvery            ; C
  1710.         dc.l    PPR_notedelay-PPR_ExtEvery            ; D
  1711.         dc.l    PPR_return-PPR_ExtEvery                ; Ex
  1712.         dc.l    PPR_return-PPR_ExtEvery                ; F
  1713.  
  1714. ;------------------------------------------------------------------------------
  1715. ;Extended effectcommands are called each frame.
  1716. ;------------------------------------------------------------------------------
  1717.  
  1718. PPR_ChkExtSometime
  1719.         ; Extended effectcommands called only the first frame...
  1720.  
  1721.         move.b    PPRV_PatternDat+3(a6),d0
  1722.         lsr.w    #4-2,d0            ; *4
  1723.         and.w    #$f<<2,d0
  1724.         lea.l    PPR_ExtSometime(pc),a1
  1725.         add.l    (a1,d0.w),a1
  1726.         jsr    (a1)
  1727.  
  1728.         rts
  1729.  
  1730. PPR_ExtSometime    dc.l    PPR_filteronoff-PPR_ExtSometime            ; 0
  1731.         dc.l    PPR_fineportaup-PPR_ExtSometime            ; 1
  1732.         dc.l    PPR_fineportadown-PPR_ExtSometime        ; 2
  1733.         dc.l    PPR_setglissctrl-PPR_ExtSometime        ; 3
  1734.         dc.l    PPR_setvibratoctrl-PPR_ExtSometime        ; 4
  1735.         dc.l    PPR_return-PPR_ExtSometime            ; 5
  1736.         dc.l    PPR_PatternLoop-PPR_ExtSometime            ; 6
  1737.         dc.l    PPR_settremoloctrl-PPR_ExtSometime        ; 7
  1738.         dc.l    PPR_return-PPR_ExtSometime            ; 8
  1739.         dc.l    PPR_return-PPR_ExtSometime            ; 9
  1740.         dc.l    PPR_volumefineup-PPR_ExtSometime        ; A
  1741.         dc.l    PPR_volumefinedown-PPR_ExtSometime        ; B
  1742.         dc.l    PPR_return-PPR_ExtSometime            ; C
  1743.         dc.l    PPR_return-PPR_ExtSometime            ; D
  1744.         dc.l    PPR_patterndelay-PPR_ExtSometime        ; Ex
  1745.         dc.l    PPR_funkit-PPR_ExtSometime            ; F
  1746.  
  1747. ;------------------------------------------------------------------------------
  1748. ; 0  - ARPEGGIO
  1749. ;------------------------------------------------------------------------------
  1750.  
  1751. PPR_arpinit    move.b    #0,PPRV_ArpCount(a6)    ; Clear arpeggio count
  1752.         rts
  1753.  
  1754. PPR_arpeggio    moveq.l    #0,d0
  1755.         move.b    PPRV_ArpCount(a6),d0
  1756.         move.b    d0,d1
  1757.         add.b    #1,d1
  1758.         cmp.b    #3,d1
  1759.         bne.s    .OkCount
  1760.  
  1761.         moveq.l    #0,d1
  1762. .OkCount    move.b    d1,PPRV_ArpCount(a6)
  1763.  
  1764.         tst.w    d0
  1765.         beq.s    PPR_arpeggio0
  1766.  
  1767.         subq    #2,d0
  1768.         beq.s    PPR_arpeggio2
  1769.  
  1770.         moveq.l    #0,d0            ; first value
  1771.         move.b    PPRV_PatternDat+3(a6),d0
  1772.         lsr.b    #4,d0
  1773.         bra.s    PPR_doarp
  1774.  
  1775. PPR_arpeggio0    move.w    PPRV_CurrPer(a6),6(a5)        ; zero arpeggio
  1776.         rts
  1777.  
  1778. PPR_arpeggio2    move.b    PPRV_PatternDat+3(a6),d0; last value
  1779.         and.w    #$0f,d0
  1780.  
  1781. PPR_doarp    add.w    d0,d0
  1782.  
  1783.     ifeq PPR_PowerPatt
  1784.             lea.l    PPR_periodtable(pc),a1
  1785.  
  1786.         ifne PPR_Finetune
  1787.             moveq.l    #0,d1
  1788.             move.b    PPRV_Finetune(a6),d1
  1789.             lsl.l    #7,d1        ; *64*2
  1790.             add.l    d1,a1
  1791.         endc
  1792.  
  1793.         move.w    PPRV_CurrPer(a6),d1
  1794.         moveq.l    #36,d7
  1795. PPR_arploop    cmp.w    (a1)+,d1        ; <- This sucks!!!
  1796.         bhs.s    PPR_arpeggio4        ; HIGHER or same?
  1797.         dbra    d7,PPR_arploop
  1798.         rts
  1799.  
  1800. PPR_arpeggio4
  1801.         ifeq PPR_NotePlayer
  1802.             move.w    -2(a1,d0.w),6(a5)    ; Fetch arpvalue...
  1803.         else
  1804.             PPRN_SetRate -2(a1,d0.w)
  1805.         endc
  1806.     else        ; If Powerpatterns were enabled
  1807.         lea.l    PPR_periodtable-2(pc),a1
  1808.  
  1809.         ifne PPR_Finetune
  1810.             moveq.l    #0,d1
  1811.             move.b    PPRV_Finetune(a6),d1
  1812.             lsl.l    #7,d1        ; *64*2
  1813.             add.l    d1,a1
  1814.         endc
  1815.  
  1816.         moveq.l    #0,d1
  1817.         add.b    PPRV_CurrNote(a6),d0
  1818. PPR_arploop
  1819.         ifeq PPR_NotePlayer
  1820.             move.w    (a1,d0.w),6(a5)    ; Fetch arpvalue...
  1821.         else
  1822.             PPRN_SetRate (a1,d0.w)
  1823.         endc
  1824.     endc
  1825.         rts
  1826.  
  1827. ;------------------------------------------------------------------------------
  1828. ; E1 - FINEPORTAMENTO UP
  1829. ;------------------------------------------------------------------------------
  1830.  
  1831. PPR_fineportaup    move.b    #$0f,PPRM_LowMask(a4)    ; Tell where argument is
  1832.  
  1833. ;------------------------------------------------------------------------------
  1834. ; 1  - PORTAMENTO UP
  1835. ;------------------------------------------------------------------------------
  1836.  
  1837. PPR_portaup    moveq.l    #0,d0
  1838.         move.b    PPRV_PatternDat+3(a6),d0
  1839.         and.b    PPRM_LowMask(a4),d0
  1840.         move.b    #$ff,PPRM_LowMask(a4)
  1841.         sub.w    d0,PPRV_CurrPer(a6)
  1842.         move.w    PPRV_CurrPer(a6),d0
  1843.         and.w    #$0fff,d0
  1844.         cmp.w    #113,d0
  1845.         bpl.s    PPR_portauskip
  1846.         and.w    #$f000,PPRV_CurrPer(a6)
  1847.         or.w    #113,PPRV_CurrPer(a6)
  1848.  
  1849. PPR_portauskip    move.w    PPRV_CurrPer(a6),d0
  1850.         and.w    #$0fff,d0
  1851.  
  1852.     ifeq PPR_NotePlayer
  1853.         move.w    d0,6(a5)
  1854.     else
  1855.         PPRN_SetRate d0
  1856.     endc
  1857.  
  1858.         rts
  1859.  
  1860. ;------------------------------------------------------------------------------
  1861. ; E2 - FINEPORTAMENTO DOWN
  1862. ;------------------------------------------------------------------------------
  1863.  
  1864. PPR_fineportadown
  1865.         move.b    #$0f,PPRM_LowMask(a4)
  1866.  
  1867. ;------------------------------------------------------------------------------
  1868. ; 2  - PORTAMENTO DOWN
  1869. ;------------------------------------------------------------------------------
  1870.  
  1871. PPR_portadown    moveq.l    #0,d0
  1872.         move.b    PPRV_PatternDat+3(a6),d0
  1873.         and.b    PPRM_LowMask(a4),d0
  1874.         move.b    #$ff,PPRM_LowMask(a4)
  1875.         add.w    d0,PPRV_CurrPer(a6)
  1876.         move.w    PPRV_CurrPer(a6),d0
  1877.         and.w    #$0fff,d0
  1878.         cmp.w    #856,d0
  1879.         bmi.s    PPR_portadskip
  1880.         and.w    #$f000,PPRV_CurrPer(a6)
  1881.         or.w    #856,PPRV_CurrPer(a6)
  1882.  
  1883. PPR_portadskip    move.w    PPRV_CurrPer(a6),d0
  1884.         and.w    #$0fff,d0
  1885.  
  1886.     ifeq PPR_NotePlayer
  1887.         move.w    d0,6(a5)
  1888.     else
  1889.         PPRN_SetRate d0
  1890.     endc
  1891.  
  1892.         rts
  1893.  
  1894. ;------------------------------------------------------------------------------
  1895. ; 3  - TONEPORTAMENTO
  1896. ;------------------------------------------------------------------------------
  1897.  
  1898.     ifeq PPR_PowerPatt
  1899. PPR_settoneporta
  1900. ;        movem.l    a0,-(sp)
  1901.         move.w    PPRV_PatternDat(a6),d2
  1902.         and.w    #$0fff,d2
  1903.         lea.l    PPR_periodtable(pc),a1
  1904.  
  1905.         ifne PPR_Finetune
  1906.             moveq.l    #0,d0
  1907.             move.b    PPRV_Finetune(a6),d0
  1908.             lsl.l    #7,d0    ; *64*2
  1909.             add.l    d0,a1
  1910.         endc
  1911.  
  1912.         moveq.l    #0,d0
  1913. PPR_stploop    cmp.w    (a1,d0.w),d2        ; I hate these loops!
  1914.         bhs.s    PPR_stpfound
  1915.         addq    #2,d0
  1916.         cmp.w    #37*2,d0
  1917.         blo.s    PPR_stploop
  1918.         moveq.l    #35*2,d0
  1919.  
  1920. PPR_stpfound    btst    #3,PPRV_Finetune(a6)
  1921.         beq.s    PPR_stpgoss
  1922.         tst.w    d0
  1923.         beq.s    PPR_stpgoss
  1924.         subq    #2,d0
  1925. PPR_stpgoss    move.w    (a1,d0.w),d2
  1926. ;        move.l    (sp)+,a0
  1927.         move.w    d2,PPRV_TPDest(a6)
  1928.         move.w    PPRV_CurrPer(a6),d0
  1929.         clr.b    PPRV_TPDir(a6)
  1930.         cmp.w    d0,d2
  1931.         beq.s    PPR_cleartoneporta
  1932.         bge.w    PPR_return
  1933.         move.b    #1,PPRV_TPDir(a6)
  1934.         rts
  1935.  
  1936. PPR_cleartoneporta
  1937.         clr.w    PPRV_TPDest(a6)
  1938.         rts
  1939.  
  1940. PPR_toneportamento
  1941.         move.b    PPRV_PatternDat+3(a6),d0
  1942.         beq.s    PPR_toneportnochange
  1943.         move.b    d0,PPRV_TPPara(a6)
  1944.         clr.b    PPRV_PatternDat+3(a6)
  1945. PPR_toneportnochange
  1946.         tst.w    PPRV_TPDest(a6)
  1947.         beq.w    PPR_return
  1948.         moveq.l    #0,d0
  1949.         move.b    PPRV_TPPara(a6),d0
  1950.         tst.b    PPRV_TPDir(a6)
  1951.         bne.s    PPR_toneportaup
  1952. PPR_toneportadown
  1953.         add.w    d0,PPRV_CurrPer(a6)
  1954.         move.w    PPRV_TPDest(a6),d0
  1955.         cmp.w    PPRV_CurrPer(a6),d0
  1956.         bgt.s    PPR_toneportasetper
  1957.         move.w    PPRV_TPDest(a6),PPRV_CurrPer(a6)
  1958.         clr.w    PPRV_TPDest(a6)
  1959.         bra.s    PPR_toneportasetper
  1960.  
  1961. PPR_toneportaup
  1962.         sub.w    d0,PPRV_CurrPer(a6)
  1963.         move.w    PPRV_TPDest(a6),d0
  1964.         cmp.w    PPRV_CurrPer(a6),d0
  1965.         blt.s    PPR_toneportasetper
  1966.         move.w    PPRV_TPDest(a6),PPRV_CurrPer(a6)
  1967.         clr.w    PPRV_TPDest(a6)
  1968.  
  1969. PPR_toneportasetper
  1970.         move.w    PPRV_CurrPer(a6),d2
  1971.         move.b    PPRV_Control2(a6),d0
  1972.         and.b    #$0f,d0
  1973.         beq.s    PPR_glissskip
  1974.         lea.l    PPR_periodtable(pc),a1
  1975.  
  1976.         ifne PPR_Finetune
  1977.             moveq.l    #0,d0
  1978.             move.b    PPRV_Finetune(a6),d0
  1979.             lsl.l    #7,d0
  1980.             add.l    d0,a1
  1981.         endc
  1982.  
  1983.         moveq.l    #0,d0
  1984. PPR_glissloop    cmp.w    (a1,d0.w),d2        ; More loops!?!
  1985.         bhs.s    PPR_glissfound
  1986.         addq    #2,d0
  1987.         cmp.w    #36*2,d0
  1988.         blo.s    PPR_glissloop
  1989.         moveq.l    #35*2,d0
  1990. PPR_glissfound
  1991.         move.w    (a1,d0.w),d2
  1992. PPR_glissskip
  1993.         ifeq PPR_NotePlayer
  1994.             move.w    d2,6(a5) ; set period
  1995.         else
  1996.             PPRN_SetRate d2
  1997.         endc
  1998.  
  1999.         rts
  2000.  
  2001.     else    ; If powerpatterns were enabled...
  2002. PPR_settoneporta
  2003. ;        movem.l    a0,-(sp)
  2004.         move.b    PPRV_PatternDat(a6),d2
  2005.         and.w    #$00ff,d2
  2006.         lea.l    PPR_periodtable-2(pc),a1
  2007.  
  2008.         ifne PPR_Finetune
  2009.             moveq.l    #0,d0
  2010.             move.b    PPRV_Finetune(a6),d0
  2011.             lsl.l    #7,d0        ; *64*2
  2012.             add.l    d0,a1
  2013.         endc
  2014.  
  2015. PPR_stp        move.w    (a1,d2.w),d2
  2016.  
  2017.         btst    #3,PPRV_Finetune(a6)
  2018.         beq.s    PPR_stpgoss
  2019.         tst.w    d0
  2020.         beq.s    PPR_stpgoss
  2021.         subq    #2,d0
  2022. PPR_stpgoss
  2023. ;        move.l    (sp)+,a0
  2024.         move.w    d2,PPRV_TPDest(a6)
  2025.         move.w    PPRV_CurrPer(a6),d0
  2026.         clr.b    PPRV_TPDir(a6)
  2027.         cmp.w    d0,d2
  2028.         beq.s    PPR_cleartoneporta
  2029.         bge.w    PPR_return
  2030.         move.b    #1,PPRV_TPDir(a6)
  2031.         rts
  2032.  
  2033. PPR_cleartoneporta
  2034.         clr.w    PPRV_TPDest(a6)
  2035.         rts
  2036.  
  2037. PPR_toneportamento
  2038.         move.b    PPRV_PatternDat+3(a6),d0
  2039.         beq.s    PPR_toneportnochange
  2040.         move.b    d0,PPRV_TPPara(a6)
  2041.         clr.b    PPRV_PatternDat+3(a6)
  2042. PPR_toneportnochange
  2043.         tst.w    PPRV_TPDest(a6)
  2044.         beq.w    PPR_return
  2045.         moveq.l    #0,d0
  2046.         move.b    PPRV_TPPara(a6),d0
  2047.         tst.b    PPRV_TPDir(a6)
  2048.         bne.s    PPR_toneportaup
  2049. PPR_toneportadown
  2050.         add.w    d0,PPRV_CurrPer(a6)
  2051.         move.w    PPRV_TPDest(a6),d0
  2052.         cmp.w    PPRV_CurrPer(a6),d0
  2053.         bgt.s    PPR_toneportasetper
  2054.         move.w    PPRV_TPDest(a6),PPRV_CurrPer(a6)
  2055.         clr.w    PPRV_TPDest(a6)
  2056.         bra.s    PPR_toneportasetper
  2057.  
  2058. PPR_toneportaup
  2059.         sub.w    d0,PPRV_CurrPer(a6)
  2060.         move.w    PPRV_TPDest(a6),d0
  2061.         cmp.w    PPRV_CurrPer(a6),d0
  2062.         blt.s    PPR_toneportasetper
  2063.         move.w    PPRV_TPDest(a6),PPRV_CurrPer(a6)
  2064.         clr.w    PPRV_TPDest(a6)
  2065.  
  2066. PPR_toneportasetper
  2067.         move.w    PPRV_CurrPer(a6),d2
  2068.         move.b    PPRV_Control2(a6),d0
  2069.         and.b    #$0f,d0
  2070.         beq.s    PPR_glissskip
  2071.  
  2072.         lea.l    PPR_periodtable(pc),a1
  2073.  
  2074.         ifne PPR_Finetune
  2075.             moveq.l    #0,d0
  2076.             move.b    PPRV_Finetune(a6),d0
  2077.             lsl.l    #7,d0
  2078.             add.l    d0,a1
  2079.         endc
  2080.  
  2081.         moveq.l    #0,d0
  2082. PPR_glissloop    cmp.w    (a1,d0.w),d2        ; I hate loops!
  2083.         bhs.s    PPR_glissfound
  2084.         addq.l    #2,d0
  2085.         cmp.w    #36*2,d0
  2086.         blo.s    PPR_glissloop
  2087.         moveq.l    #35*2,d0
  2088.  
  2089. PPR_glissfound    move.w    (a1,d0.w),d2
  2090.  
  2091. PPR_glissskip
  2092.         ifeq PPR_NotePlayer
  2093.             move.w    d2,6(a5) ; set period
  2094.         else
  2095.             PPRN_SetRate d2
  2096.         endc
  2097.  
  2098.         rts
  2099.     endc
  2100.  
  2101. ;------------------------------------------------------------------------------
  2102. ; 4  - VIBRATO
  2103. ;------------------------------------------------------------------------------
  2104.  
  2105. PPR_vibrato    move.b    PPRV_PatternDat+3(a6),d0
  2106.         beq.s    PPR_vibrato2
  2107.         move.b    PPRV_VibPara(a6),d2
  2108.         and.b    #$0f,d0
  2109.         beq.s    PPR_vibskip
  2110.         and.b    #$f0,d2
  2111.         or.b    d0,d2
  2112. PPR_vibskip
  2113.         move.b    PPRV_PatternDat+3(a6),d0
  2114.         and.b    #$f0,d0
  2115.         beq.s    PPR_vibskip2
  2116.         and.b    #$0f,d2
  2117.         or.b    d0,d2
  2118. PPR_vibskip2
  2119.         move.b    d2,PPRV_VibPara(a6)
  2120. PPR_vibrato2
  2121.         move.b    PPRV_VibCount(a6),d0
  2122.         lea.l    PPR_vibratotable(pc),a1
  2123.         lsr.w    #2,d0
  2124.         and.w    #$001f,d0
  2125.         move.b    PPRV_Control1(a6),d2
  2126.         and.w    #$03,d2
  2127.         beq.s    PPR_vib_sine
  2128.         lsl.b    #3,d0
  2129.         cmp.b    #1,d2
  2130.         beq.s    PPR_vib_rampdown
  2131.     moveq.l    #127,d2
  2132.     or.b    #$80,d2
  2133.         bra.s    PPR_vib_set
  2134. PPR_vib_rampdown
  2135.         tst.b    PPRV_VibCount(a6)
  2136.         bpl.s    PPR_vib_rampdown2
  2137.     moveq.l    #127,d0
  2138.     or.b    #$80,d0
  2139.         sub.b    d0,d2
  2140.         bra.s    PPR_vib_set
  2141. PPR_vib_rampdown2
  2142.         move.b    d0,d2
  2143.         bra.s    PPR_vib_set
  2144. PPR_vib_sine
  2145.         move.b    0(a1,d0.w),d2
  2146. PPR_vib_set
  2147.         move.b    PPRV_VibPara(a6),d0
  2148.         and.w    #15,d0
  2149.         mulu    d0,d2
  2150.         lsr.w    #7,d2
  2151.         move.w    PPRV_CurrPer(a6),d0
  2152.         tst.b    PPRV_VibCount(a6)
  2153.         bmi.s    PPR_vibratoneg
  2154.         add.w    d2,d0
  2155.         bra.s    PPR_vibrato3
  2156. PPR_vibratoneg
  2157.         sub.w    d2,d0
  2158. PPR_vibrato3
  2159.     ifeq PPR_NotePlayer
  2160.         move.w    d0,6(a5)
  2161.     else
  2162.         PPRN_SetRate d0
  2163.     endc
  2164.  
  2165.         move.b    PPRV_VibPara(a6),d0
  2166.         lsr.w    #2,d0
  2167.         and.w    #$003c,d0
  2168.         add.b    d0,PPRV_VibCount(a6)
  2169.         rts
  2170.  
  2171. ;------------------------------------------------------------------------------
  2172. ; 5  - TONEPORTAMENTO + VOLUMESLIDE
  2173. ;------------------------------------------------------------------------------
  2174.  
  2175. PPR_toneplusvolslide
  2176.         pea.l    PPR_volumeslide(pc)
  2177.         bra.w    PPR_toneportnochange
  2178.  
  2179. ;------------------------------------------------------------------------------
  2180. ; 6  - VIBRATO + VOLUMESLIDE
  2181. ;------------------------------------------------------------------------------
  2182.  
  2183. PPR_vibratoplusvolslide
  2184.         pea.l    PPR_volumeslide(pc)
  2185.         bra.w    PPR_vibrato2
  2186.  
  2187. ;------------------------------------------------------------------------------
  2188. ; 7  - TREMOLO
  2189. ;------------------------------------------------------------------------------
  2190.  
  2191. PPR_tremolo    move.b    PPRV_PatternDat+3(a6),d0
  2192.         beq.s    PPR_tremolo2
  2193.         move.b    PPRV_TremPara(a6),d2
  2194.         and.b    #$0f,d0
  2195.         beq.s    PPR_treskip
  2196.         and.b    #$f0,d2
  2197.         or.b    d0,d2
  2198. PPR_treskip
  2199.         move.b    PPRV_PatternDat+3(a6),d0
  2200.         and.b    #$f0,d0
  2201.         beq.s    PPR_treskip2
  2202.         and.b    #$0f,d2
  2203.         or.b    d0,d2
  2204. PPR_treskip2
  2205.         move.b    d2,PPRV_TremPara(a6)
  2206. PPR_tremolo2
  2207.         move.b    PPRV_TremCount(a6),d0
  2208.         lea.l    PPR_vibratotable(pc),a1
  2209.         lsr.w    #2,d0
  2210.         and.w    #$001f,d0
  2211.         moveq.l    #0,d2
  2212.         move.b    PPRV_Control1(a6),d2
  2213.         lsr.b    #4,d2
  2214.         and.b    #$03,d2
  2215.         beq.s    PPR_tre_sine
  2216.         lsl.b    #3,d0
  2217.         cmp.b    #1,d2
  2218.         beq.s    PPR_tre_rampdown
  2219.     moveq.l    #127,d2
  2220.     or.b    #$80,d2
  2221.         bra.s    PPR_tre_set
  2222. PPR_tre_rampdown
  2223.         tst.b    PPRV_VibCount(a6)
  2224.         bpl.s    PPR_tre_rampdown2
  2225.     moveq.l    #127,d2
  2226.     or.b    #$80,d2
  2227.         sub.b    d0,d2
  2228.         bra.s    PPR_tre_set
  2229. PPR_tre_rampdown2
  2230.         move.b    d0,d2
  2231.         bra.s    PPR_tre_set
  2232. PPR_tre_sine
  2233.         move.b    0(a1,d0.w),d2
  2234. PPR_tre_set
  2235.         move.b    PPRV_TremPara(a6),d0
  2236.         and.w    #15,d0
  2237.         mulu    d0,d2
  2238.         lsr.w    #6,d2
  2239.         moveq.l    #0,d0
  2240.         move.b    PPRV_Volume(a6),d0
  2241.         tst.b    PPRV_TremCount(a6)
  2242.         bmi.s    PPR_tremoloneg
  2243.         add.w    d2,d0
  2244.         bra.s    PPR_tremolo3
  2245. PPR_tremoloneg
  2246.         sub.w    d2,d0
  2247. PPR_tremolo3
  2248.         bpl.s    PPR_tremoloskip
  2249.         moveq.l    #0,d0
  2250. PPR_tremoloskip
  2251.         cmp.w    #$40,d0
  2252.         bls.s    PPR_tremolook
  2253.         moveq.l    #$40,d0
  2254. PPR_tremolook
  2255.  
  2256.     ifeq PPR_NotePlayer
  2257.         ifne PPR_MasterVol
  2258.             PPR_CALCVOL2    d0
  2259.         else
  2260.             move.w    d0,9(a5)
  2261.         endc
  2262.     else
  2263.         PPRN_SetVolume d0
  2264.     endc
  2265.  
  2266.         move.b    PPRV_TremPara(a6),d0
  2267.         lsr.w    #2,d0
  2268.         and.w    #$003c,d0
  2269.         add.b    d0,PPRV_TremCount(a6)
  2270.         rts
  2271.  
  2272. ;------------------------------------------------------------------------------
  2273. ; 8  - SYNC VALUE
  2274. ;------------------------------------------------------------------------------
  2275.  
  2276. PPR_syncval    move.b    PPRV_PatternDat+3(a6),PPRM_Msg(a4)
  2277.         rts
  2278.  
  2279. ;------------------------------------------------------------------------------
  2280. ; 9  - SAMPLE OFFSET
  2281. ;------------------------------------------------------------------------------
  2282.  
  2283. PPR_sampleoffset
  2284.         moveq.l    #0,d0
  2285.         move.b    PPRV_PatternDat+3(a6),d0
  2286.         beq.s    PPR_sononew
  2287.         move.b    d0,PPRV_SOffsPara(a6)
  2288.  
  2289. PPR_sononew    move.b    PPRV_SOffsPara(a6),d0
  2290.         lsl.w    #7,d0
  2291.         cmp.w    PPRV_PlaySize(a6),d0
  2292.         bge.s    PPR_sofskip
  2293.         sub.w    d0,PPRV_PlaySize(a6)
  2294.         add.w    d0,d0
  2295.         add.l    d0,PPRV_SamplePtr(a6)
  2296.         rts
  2297. PPR_sofskip
  2298.         move.w    #$0001,PPRV_PlaySize(a6)
  2299.         rts
  2300.  
  2301. ;------------------------------------------------------------------------------
  2302. ; A  - VOLUME SLIDE
  2303. ;------------------------------------------------------------------------------
  2304.  
  2305. PPR_volumeslide    moveq.l    #0,d0
  2306.         move.b    PPRV_PatternDat+3(a6),d0
  2307.         lsr.b    #4,d0
  2308.         tst.b    d0
  2309.         beq.s    PPR_volslidedown
  2310. PPR_volslideup
  2311.         add.b    d0,PPRV_Volume(a6)
  2312.         cmp.b    #$40,PPRV_Volume(a6)
  2313.         bmi.s    PPR_vsuskip
  2314.         move.b    #$40,PPRV_Volume(a6)
  2315. PPR_vsuskip
  2316.     ifeq PPR_NotePlayer
  2317.         ifne PPR_MasterVol
  2318.             PPR_CALCVOL    d0
  2319.         else
  2320.             move.b    PPRV_Volume(a6),9(a5)
  2321.         endc
  2322.     else
  2323.         PPRN_SetVolume PPRV_Volume(a6)
  2324.     endc
  2325.  
  2326.         rts
  2327.  
  2328. PPR_volslidedown
  2329.         move.b    PPRV_PatternDat+3(a6),d0
  2330.         and.w    #$0f,d0
  2331. PPR_volslidedown2
  2332.         sub.b    d0,PPRV_Volume(a6)
  2333.         bpl.s    PPR_vsdskip
  2334.         clr.b    PPRV_Volume(a6)
  2335. PPR_vsdskip
  2336.     ifeq PPR_NotePlayer
  2337.         ifne PPR_MasterVol
  2338.             PPR_CALCVOL    d0
  2339.         else
  2340.             move.b    PPRV_Volume(a6),9(a5)
  2341.         endc
  2342.     else
  2343.         PPRN_SetVolume PPRV_Volume(a6)
  2344.     endc
  2345.         rts
  2346.  
  2347. ;------------------------------------------------------------------------------
  2348. ; B  - POSITION JUMP
  2349. ;------------------------------------------------------------------------------
  2350.  
  2351. PPR_positionjump
  2352.         move.b    PPRV_PatternDat+3(a6),d0
  2353.         subq    #1,d0
  2354.         move.b    d0,PPRM_SongPos(a4)
  2355.         st.b    PPRM_RestFlag(a4)
  2356. PPR_pj2        clr.b    PPRM_PBreakPos(a4)
  2357.         st     PPRM_PosJumpFl(a4)
  2358.         rts
  2359.  
  2360. ;------------------------------------------------------------------------------
  2361. ; C  - SET VOLUME
  2362. ;------------------------------------------------------------------------------
  2363.  
  2364. PPR_volumechange
  2365.         move.b    PPRV_PatternDat+3(a6),d0
  2366.         cmp.b    #$40,d0
  2367.         bls.s    PPR_volumeok
  2368.         moveq.l    #$40,d0
  2369. PPR_volumeok
  2370.         move.b    d0,PPRV_Volume(a6)        ; Store volume
  2371.  
  2372.     ifeq PPR_NotePlayer
  2373.         ifne PPR_MasterVol
  2374.             PPR_CALCVOL2    d0
  2375.         else
  2376.             move.b    d0,9(a5)
  2377.         endc
  2378.     else
  2379.         PPRN_SetVolume d0
  2380.     endc
  2381.  
  2382.         rts
  2383.  
  2384. ;------------------------------------------------------------------------------
  2385. ; D  - PATTERN BREAK
  2386. ;------------------------------------------------------------------------------
  2387.  
  2388. PPR_patternbreak
  2389.         moveq.l    #0,d0
  2390.         move.b    PPRV_PatternDat+3(a6),d0
  2391.         move.w    d0,d2
  2392.         lsr.b    #4,d0
  2393.         add    d0,d0
  2394.         move    d0,d1
  2395.         add    d0,d0
  2396.         add    d0,d0
  2397.         add    d1,d0
  2398.         and.b    #$0f,d2
  2399.         add.b    d2,d0
  2400.         cmp.b    #63,d0
  2401.         bhi.s    PPR_pj2
  2402.         move.b    d0,PPRM_PBreakPos(a4)
  2403.         st    PPRM_PosJumpFl(a4)
  2404.         rts
  2405.  
  2406. ;------------------------------------------------------------------------------
  2407. ; F  - SET SPEED
  2408. ;------------------------------------------------------------------------------
  2409.  
  2410. PPR_setspeed    move.b    PPRV_PatternDat+3(a6),d0
  2411.         bne.s    .NotHalt
  2412.  
  2413.         st.b    PPRM_RestFlag(a4)
  2414.  
  2415. .NotHalt    clr.b    PPRM_Counter(a4)
  2416.     ifne PPR_CIA
  2417.         cmp.b    #32,d0
  2418.         bhs.s    PPR_SetBPM
  2419.  
  2420.     endc
  2421.         move.b    d0,PPRM_Speed(a4)
  2422.         rts
  2423.  
  2424. ;------------------------------------------------------------------------------
  2425. ; E0 - SET FILTER
  2426. ;------------------------------------------------------------------------------
  2427.  
  2428. PPR_filteronoff    move.b    PPRV_PatternDat+3(a6),d0
  2429.  
  2430.     ifeq PPR_NotePlayer
  2431.         and.b    #1,d0
  2432.         bne.s    .Set
  2433.  
  2434. .Clr        and.b    #~2,$bfe001
  2435.         rts
  2436.  
  2437. .Set        or.b    #2,$bfe001
  2438.     else
  2439.         PPRN_Filter d0
  2440.     endc
  2441.  
  2442.         rts
  2443.  
  2444. ;------------------------------------------------------------------------------
  2445. ; E3 - GLISSANDO CONTROL
  2446. ;------------------------------------------------------------------------------
  2447.  
  2448. PPR_setglissctrl
  2449.         move.b    PPRV_PatternDat+3(a6),d0
  2450.         and.b    #$0f,d0
  2451.         and.b    #$f0,PPRV_Control2(a6)
  2452.         or.b    d0,PPRV_Control2(a6)
  2453.         rts
  2454.  
  2455. ;------------------------------------------------------------------------------
  2456. ; E4 - VIBRATO CONTROL
  2457. ;------------------------------------------------------------------------------
  2458.  
  2459. PPR_setvibratoctrl
  2460.         move.b    PPRV_PatternDat+3(a6),d0
  2461.         and.b    #$0f,d0
  2462.         and.b    #$f0,PPRV_Control1(a6)
  2463.         or.b    d0,PPRV_Control1(a6)
  2464.         rts
  2465.  
  2466. ;------------------------------------------------------------------------------
  2467. ; E5 - SET FINETUNE
  2468. ;------------------------------------------------------------------------------
  2469.  
  2470.     ifne PPR_Finetune
  2471. PPR_setfinetune    move.b    PPRV_PatternDat+3(a6),d0
  2472.         and.b    #$0f,d0
  2473.         move.b    d0,PPRV_Finetune(a6)
  2474.         rts
  2475.     endc
  2476.  
  2477. ;------------------------------------------------------------------------------
  2478. ; E6 - PATTERN LOOP
  2479. ;------------------------------------------------------------------------------
  2480.  
  2481. PPR_PatternLoop    move.b    PPRV_PatternDat+3(a6),d0
  2482.         and.b    #$0f,d0
  2483.         beq.s    PPR_setloop
  2484.  
  2485.         tst.b    PPRV_PLoopCount(a6)
  2486.         beq.s    PPR_jumpcnt
  2487.  
  2488.         subq.b    #1,PPRV_PLoopCount(a6)
  2489.         beq.w    PPR_return
  2490.  
  2491. PPR_jmploop     move.b    PPRV_PLoopPos(a6),PPRM_PBreakPos(a4)
  2492.         st    PPRM_PBreakFl(a4)
  2493.         rts
  2494.  
  2495. PPR_jumpcnt    move.b    d0,PPRV_PLoopCount(a6)
  2496.         bra.s    PPR_jmploop
  2497.  
  2498. PPR_setloop    move.w    PPRM_PatternPos(a4),d0    ; Store loop position
  2499.         lsr.w    #2,d0            ; /2 = number offset
  2500.         move.b    d0,PPRV_PLoopPos(a6)
  2501.         rts
  2502.  
  2503. ;------------------------------------------------------------------------------
  2504. ; E7 - TREMOLO CONTROL
  2505. ;------------------------------------------------------------------------------
  2506.  
  2507. PPR_settremoloctrl
  2508.         move.b    PPRV_PatternDat+3(a6),d0
  2509.         and.b    #$0f,d0
  2510.         lsl.b    #4,d0
  2511.         and.b    #$0f,PPRV_Control1(a6)
  2512.         or.b    d0,PPRV_Control1(a6)
  2513.         rts
  2514.  
  2515. ;------------------------------------------------------------------------------
  2516. ; E9 - RETRIG NOTE
  2517. ;------------------------------------------------------------------------------
  2518.  
  2519. PPR_retrignote
  2520. ;        move.l    d1,-(sp)
  2521.         move.b    PPRV_PatternDat+3(a6),d0
  2522.         and.w    #$0f,d0
  2523.         beq.w    PPR_rtnend
  2524.  
  2525.         moveq.l    #0,d1
  2526.         move.b    PPRM_Counter(a4),d1
  2527.         bne.s    PPR_rtnskp        ; If start of note...
  2528.  
  2529.     ifeq PPR_PowerPatt
  2530.         move.w    PPRV_PatternDat(a6),d1    ; ...only trig if note set!
  2531.         and.w    #$0fff,d1
  2532.         bne.w    PPR_rtnend
  2533.     else
  2534.         move.b    PPRV_PatternDat(a6),d1
  2535.         bne.w    PPR_rtnend
  2536.     endc
  2537.  
  2538.         moveq.l    #0,d1
  2539.         move.b    PPRM_Counter(a4),d1
  2540.  
  2541. PPR_rtnskp    divu    d0,d1
  2542.         swap    d1
  2543. ;        tst.w    d1
  2544. ;        bne.s    PPR_rtnend
  2545.         dbra    d1,PPR_rtnend        ; ...Not the time?
  2546.  
  2547. PPR_doretrig
  2548.     ifeq PPR_NotePlayer
  2549.         move.w    PPRV_DMAMask(a6),$dff096; Channel DMA off
  2550.         move.l    PPRV_SamplePtr(a6),(a5)    ; Set sampledata pointer
  2551.         move.w    PPRV_PlaySize(a6),4(a5)    ; Set length
  2552.         PPR_WAITDMA
  2553.         move.w    PPRV_DMAMask(a6),d0
  2554.         or.w    #2^15,d0        ; BSET #15,d0
  2555.         move.w    d0,$dff096        ; Channel DMA on
  2556. PPR_Dummy02    PPR_WAITDMA
  2557.         move.l    PPRV_LoopStart(a6),(a5)    ; Write more data...
  2558.         move.l    PPRV_RepLen(a6),4(a5)
  2559.     else
  2560.         PPRN_TrigWave PPRV_SamplePtr(a6),PPRV_PlaySize(a6)
  2561.         PPRN_SetWave PPRV_LoopStart(a6),PPRV_RepLen(a6)
  2562.     endc
  2563.  
  2564. PPR_rtnend
  2565. ;        move.l    (sp)+,d1
  2566.         rts
  2567.  
  2568. ;------------------------------------------------------------------------------
  2569. ; EA - VOLUME FINESLIDE UP
  2570. ;------------------------------------------------------------------------------
  2571.  
  2572. PPR_volumefineup
  2573.         move.b    PPRV_PatternDat+3(a6),d0
  2574.         and.w    #$f,d0
  2575.         bra.w    PPR_volslideup
  2576.  
  2577. ;------------------------------------------------------------------------------
  2578. ; EB - VOLUME FINESLIDE DOWN
  2579. ;------------------------------------------------------------------------------
  2580.  
  2581. PPR_volumefinedown
  2582.         move.b    PPRV_PatternDat+3(a6),d0
  2583.         and.w    #$0f,d0
  2584.         bra.w    PPR_volslidedown2
  2585.  
  2586. ;------------------------------------------------------------------------------
  2587. ; EB - NOTECUT
  2588. ;------------------------------------------------------------------------------
  2589.  
  2590. PPR_notecut    move.b    PPRV_PatternDat+3(a6),d0
  2591.         and.w    #$0f,d0
  2592.         cmp.b    PPRM_Counter(a4),d0
  2593.         bne.w    PPR_return        ; Has the time come?
  2594.  
  2595.         clr.b    PPRV_Volume(a6)
  2596.  
  2597.     ifeq PPR_NotePlayer
  2598.         move.w    #0,8(a5)
  2599.     else
  2600.         PPRN_SetVolume #0
  2601.     endc
  2602.         rts
  2603.  
  2604. ;------------------------------------------------------------------------------
  2605. ; ED - NOTEDELAY
  2606. ;------------------------------------------------------------------------------
  2607.  
  2608. PPR_notedelay    move.b    PPRV_PatternDat+3(a6),d0
  2609.         and.w    #$0f,d0
  2610.         cmp.b    PPRM_Counter(a4),d0    ; Has the time come?
  2611.         bne.w    PPR_return
  2612.  
  2613.         move.w    PPRV_PatternDat(a6),d0
  2614.         beq.w    PPR_return
  2615. ;        move.l    d1,-(sp)
  2616.         bra.w    PPR_doretrig        ; Trig note
  2617.  
  2618. ;------------------------------------------------------------------------------
  2619. ; EE - PATTERN DELAY
  2620. ;------------------------------------------------------------------------------
  2621.  
  2622. PPR_patterndelay
  2623.         move.b    PPRV_PatternDat+3(a6),d0
  2624.         and.w    #$0f,d0
  2625.         tst.b    PPRM_PtDelTime(a4)
  2626.         bne.w    PPR_return        ; We are already delaying...
  2627.         tst.b    PPRM_PtDelCount(a4)
  2628.         bne.w    PPR_return        ; We are already delaying...
  2629.         addq.b    #1,d0
  2630.         move.b    d0,PPRM_PtDelTime(a4)    ; Store delay count
  2631.         rts
  2632.  
  2633. ;------------------------------------------------------------------------------
  2634. ; EF - FUNKREPEAT
  2635. ;------------------------------------------------------------------------------
  2636.  
  2637. PPR_funkit    move.b    PPRV_PatternDat+3(a6),d0
  2638.         and.b    #$0f,d0
  2639.         lsl.b    #4,d0
  2640.         and.b    #$0f,PPRV_Control2(a6)
  2641.         or.b    d0,PPRV_Control2(a6)    ; Store speed
  2642.         tst.b    d0
  2643.         beq.w    PPR_return        ; If no speed, return
  2644.  
  2645. PPR_updatefunk
  2646. ;        movem.l    d1/a0,-(sp)
  2647.         moveq.l    #0,d0
  2648.         move.b    PPRV_Control2(a6),d0
  2649.         lsr.b    #4,d0            ; Get speed
  2650.         beq.s    PPR_funkend        ; No speed, no funk
  2651.  
  2652.         lea.l    PPR_funktable(pc),a1
  2653.         move.b    (a1,d0.w),d0
  2654.         add.b    d0,PPRV_FunkDuh(a6)
  2655.  
  2656.         btst    #7,PPRV_FunkDuh(a6)    ; Y = 128?
  2657.         beq.s    PPR_funkend        ; No...
  2658.  
  2659.         clr.b    PPRV_FunkDuh(a6)    ; Y = 0
  2660.  
  2661.         move.l    PPRV_LoopStart(a6),d0
  2662.         moveq.l    #0,d1
  2663.         move.w    PPRV_RepLen(a6),d1
  2664.         add.l    d1,d0
  2665.         add.l    d1,d0
  2666.         move.l    PPRV_FunkPtr(a6),a0
  2667.         addq.l    #1,a1
  2668.         cmp.l    d0,a1
  2669.         blo.s    PPR_funkok
  2670.         move.l    PPRV_LoopStart(a6),a1    ; Init pointer
  2671.  
  2672. PPR_funkok    move.l    a1,PPRV_FunkPtr(a6)
  2673.         neg.b    (a1)
  2674.         subq.b    #1,(a1)
  2675.  
  2676. PPR_funkend
  2677. ;        movem.l    (sp)+,d1/a0
  2678.         rts
  2679.  
  2680. ;------------------------------------------------------------------------------
  2681. ;    Tables and miscellaneous stuff...
  2682. ;------------------------------------------------------------------------------
  2683.  
  2684. PPR_funktable    dc.b   0,  5,  6,  7,  8, 10, 11, 13
  2685.         dc.b  16, 19, 22, 26, 32, 43, 64,128
  2686.  
  2687. PPR_vibratotable
  2688.         dc.b   0, 24, 49, 74, 97,120,141,161
  2689.         dc.b 180,197,212,224,235,244,250,253
  2690.         dc.b 255,253,250,244,235,224,212,197
  2691.         dc.b 180,161,141,120, 97, 74, 49, 24
  2692.  
  2693.         dc.w    0
  2694. PPR_periodtable
  2695. ; tuning 0, normal
  2696.         dc.w    856,808,762,720,678,640,604,570,538,508,480,453
  2697.         dc.w    428,404,381,360,339,320,302,285,269,254,240,226
  2698.         dc.w    214,202,190,180,170,160,151,143,135,127,120,113
  2699.         dcb.w    64-36,0
  2700.  
  2701.     ifne PPR_Finetune
  2702. ; tuning 1
  2703.         dc.w    850,802,757,715,674,637,601,567,535,505,477,450
  2704.         dc.w    425,401,379,357,337,318,300,284,268,253,239,225
  2705.         dc.w    213,201,189,179,169,159,150,142,134,126,119,113
  2706.         dcb.w    64-36,0
  2707. ; tuning 2
  2708.         dc.w    844,796,752,709,670,632,597,563,532,502,474,447
  2709.         dc.w    422,398,376,355,335,316,298,282,266,251,237,224
  2710.         dc.w    211,199,188,177,167,158,149,141,133,125,118,112
  2711.         dcb.w    64-36,0
  2712. ; tuning 3
  2713.         dc.w    838,791,746,704,665,628,592,559,528,498,470,444
  2714.         dc.w    419,395,373,352,332,314,296,280,264,249,235,222
  2715.         dc.w    209,198,187,176,166,157,148,140,132,125,118,111
  2716.         dcb.w    64-36,0
  2717. ; tuning 4
  2718.         dc.w    832,785,741,699,660,623,588,555,524,495,467,441
  2719.         dc.w    416,392,370,350,330,312,294,278,262,247,233,220
  2720.         dc.w    208,196,185,175,165,156,147,139,131,124,117,110
  2721.         dcb.w    64-36,0
  2722. ; tuning 5
  2723.         dc.w    826,779,736,694,655,619,584,551,520,491,463,437
  2724.         dc.w    413,390,368,347,328,309,292,276,260,245,232,219
  2725.         dc.w    206,195,184,174,164,155,146,138,130,123,116,109
  2726.         dcb.w    64-36,0
  2727. ; tuning 6
  2728.         dc.w    820,774,730,689,651,614,580,547,516,487,460,434
  2729.         dc.w    410,387,365,345,325,307,290,274,258,244,230,217
  2730.         dc.w    205,193,183,172,163,154,145,137,129,122,115,109
  2731.         dcb.w    64-36,0
  2732. ; tuning 7
  2733.         dc.w    814,768,725,684,646,610,575,543,513,484,457,431
  2734.         dc.w    407,384,363,342,323,305,288,272,256,242,228,216
  2735.         dc.w    204,192,181,171,161,152,144,136,128,121,114,108
  2736.         dcb.w    64-36,0
  2737. ; tuning -8
  2738.         dc.w    907,856,808,762,720,678,640,604,570,538,508,480
  2739.         dc.w    453,428,404,381,360,339,320,302,285,269,254,240
  2740.         dc.w    226,214,202,190,180,170,160,151,143,135,127,120
  2741.         dcb.w    64-36,0
  2742. ; tuning -7
  2743.         dc.w    900,850,802,757,715,675,636,601,567,535,505,477
  2744.         dc.w    450,425,401,379,357,337,318,300,284,268,253,238
  2745.         dc.w    225,212,200,189,179,169,159,150,142,134,126,119
  2746.         dcb.w    64-36,0
  2747. ; tuning -6
  2748.         dc.w    894,844,796,752,709,670,632,597,563,532,502,474
  2749.         dc.w    447,422,398,376,355,335,316,298,282,266,251,237
  2750.         dc.w    223,211,199,188,177,167,158,149,141,133,125,118
  2751.         dcb.w    64-36,0
  2752. ; tuning -5
  2753.         dc.w    887,838,791,746,704,665,628,592,559,528,498,470
  2754.         dc.w    444,419,395,373,352,332,314,296,280,264,249,235
  2755.         dc.w    222,209,198,187,176,166,157,148,140,132,125,118
  2756.         dcb.w    64-36,0
  2757. ; tuning -4
  2758.         dc.w    881,832,785,741,699,660,623,588,555,524,494,467
  2759.         dc.w    441,416,392,370,350,330,312,294,278,262,247,233
  2760.         dc.w    220,208,196,185,175,165,156,147,139,131,123,117
  2761.         dcb.w    64-36,0
  2762. ; tuning -3
  2763.         dc.w    875,826,779,736,694,655,619,584,551,520,491,463
  2764.         dc.w    437,413,390,368,347,328,309,292,276,260,245,232
  2765.         dc.w    219,206,195,184,174,164,155,146,138,130,123,116
  2766.         dcb.w    64-36,0
  2767. ; tuning -2
  2768.         dc.w    868,820,774,730,689,651,614,580,547,516,487,460
  2769.         dc.w    434,410,387,365,345,325,307,290,274,258,244,230
  2770.         dc.w    217,205,193,183,172,163,154,145,137,129,122,115
  2771.         dcb.w    64-36,0
  2772. ; tuning -1
  2773.         dc.w    862,814,768,725,684,646,610,575,543,513,484,457
  2774.         dc.w    431,407,384,363,342,323,305,288,272,256,242,228
  2775.         dc.w    216,203,192,181,171,161,152,144,136,128,121,114
  2776.         dcb.w    64-36,0
  2777.     endc
  2778.         dc.w    0
  2779.  
  2780.     CNOP    0,4
  2781.  
  2782. PPR_MainData    dcb.b    PPRM_sizeof,0
  2783.  
  2784. PPR_VoiceData    dcb.b    PPRV_sizeof*4,0
  2785.  
  2786.     SECTION Module,DATA_C
  2787.  
  2788.     INCDIR    "!SOURCES:PRODUCTIONS/PTSUPP/PROPRUNER/"
  2789.  
  2790. Module    ;INCBIN    "PPR.BLOB"
  2791.     ;INCBIN    "PPR.PANIC UTEN ERROR..."
  2792.     ;INCBIN    "PPR.CHIP_3"
  2793.     INCBIN    "PPR.TETRIS THEME"
  2794.     ;INCBIN    "PPR.NOW WHAT 3"
  2795.     ;INCBIN "HD2:PPR.A"
  2796.  
  2797.